Servlet 3.0 使用注解配置URl提示404错误
我的环境是 Eclipse oxygen + Servlet 3.0
因为3.0已经开始使用注解了
之前我都是配置listenner 还有Servlet mapping 在 web.xml 中
就像 这样子

在xml中配置

现在 有了 注解 我们只需要在对应的 类上 写上 他的标签即可


就像 上图 所示
需要注意 的 一点是
matadata-complete 必须设置为false
Attribute : metadata-complete
The metadata-complete attribute defines whether this deployment descriptor and other
related deployment descriptors for this module (e.g., web service descriptors) are complete, or
whether the class files available to this module and packaged with this application should be
examined for annotations that specify deployment information. If metadata-complete is set to
"true", the deployment tool must ignore any annotations that specify deployment information,
which might be present in the class files of the application. If metadata-complete is not
specified or is set to "false", the deployment tool must examine the class files of the application
for annotations, as specified by the specifications.
Data Type : boolean
Enumerated Values :
- true
- false
可以 看到 true 的话 会 忽略注解 false 的 才会使用注解

Servlet 3.0 使用注解配置URl提示404错误的更多相关文章
- Servlet使用注解配置URl提示404错误
刚接触servlet 3.0,使用注释描述servlet @WebServlet(name="FirstServlet", urlPatterns="/FirstServ ...
- c# webapi发布到windows server 2008 r2 iis上提示404错误
项目服务端是一组RestFul风格的webapi,发布到本机的iis没有问题,但是发布到服务器以后就提示404错误.本机是win10的,服务器是windows server 2008 R2 64位.之 ...
- tomcat + jenkins启动tomcat后打开jenkins页面提示404错误的解决方案
首先下载tomcat和jenkins,将下载的jenkins2.12 war放到tomcat的webapps文件夹下后执行/bin文件夹下的start启动后,打开http://localhost:80 ...
- iis7 部署 mvc4项目提示404错误
1.装了.net framework 4.0框架 2.重新注册了asp.net_iisreg -i 访问mvc项目仍提示404错误 搜了一下,有些服务器还要装个补丁 https://support.m ...
- 在使用webstorm打开本地项目文件夹的html文件时,浏览器提示404错误
错误原因:在使用webstorm打开本地项目文件夹的html文件时,浏览器提示404错误. 错误分析:文件夹命名内包含“+”,此特殊符号导致浏览器解析错误. 改正方案:去掉特殊符号“+”
- Servlet --启动时创建、配置url、ServlectContext、初始化参数、获取资源
servlet的版本的区别 2.5版本, Servlet的配置只支持在xml文件中的配置 3.0版本: Servlet的配置支持在xml文件中的配置, 也可以使用注解的方式, 默认使用注解 让服务器在 ...
- Servlet生命周期和注解配置
Servlet的生命周期和注解配置问题 /* Servlet? 运行在服务器上的小程序 定义浏览器访问到Tomcat的规则 一.生命周期? 1.创建 2.提供服务 3.被销毁 二.servlet3.0 ...
- Servlet(二)----注解配置
## Servlet3.0 * 好处: * 支持注解配置.可以不需要web.xml了. * 步骤: 1.创建JavaEE项目,选择Servlet的版本3.0以上,可以不创建web.xml 2. ...
- 【Javaweb】Servlet的xml和注解配置
1.xml <%@ page language="java" contentType="text/html;" %> <!DOCTYPE ht ...
随机推荐
- G++与VS2015在变量作用域上的差异性
前段时间,发现同一段C++代码在windows .Linux下的运行结果居然不一样,于是测试了一把. 我们都知道,C++中不同作用域中不同的变量是互不干扰的,可以在全局作用域.函数作用域声明同样名字的 ...
- 【Tomcat】shell获得war包
功能: 将maven项目打包复制到tomcat/webapps set git=C:\Users\zhengwenqiang\git set tomcat=e:\tomcat7.0.64 c: cd ...
- 【Ubuntu 16】 wifi连接 并解决无桌面图标问题
笔记本上装了win10和ubuntu16双系统,ubuntu16有半年多没使用了,今天一登录成功后,没有桌面啦,一个干净的壁纸映入眼帘,真操蛋. 上网搜索后总结:应该是应用软件中心出了问题,可是,没法 ...
- jquery的2.0.3版本源码系列(5):349-817行,extend添加的工具方法
expando 生成唯一JQ字符串(内部)noconflict避免冲突isReady DOM是否加载完成(DOMContentLoaded)readyReady
- jquery的2.0.3版本源码系列(3):96行-283行,给JQ对象,添加一些方法和属性
jquery是面向对象的程序,面向对象就离不开方法和属性. 方法的简化 jQuery.fn=jQuery.prototype={ jquery: 版本 constructor: 修正指向问题 init ...
- Just for Today
Just for today I will try to live through this day only and not tackle my whole life problem at once ...
- 深入浅出数据结构C语言版(14)——散列表
我们知道,由于二叉树的特性(完美情况下每次比较可以排除一半数据),对其进行查找算是比较快的了,时间复杂度为O(logN).但是,是否存在支持时间复杂度为常数级别的查找的数据结构呢?答案是存在,那就是散 ...
- 为Ext添加下拉框和日期组件
Ext.onReady(function(){ var config = { fields:['module'], data:[['新建'],['删除'],['增加']}; var store = n ...
- [js高手之路]node js系列课程-创建简易web服务器与文件读写
web服务器至少有以下几个特点: 1.24小时不停止的工作,也就是说这个进程要常驻在内存中 2.24小时在某一端口监听,如: http://localhost:8080, www服务器默认端口80 3 ...
- node简单配置一台服务器
要想使用nodeJS来搭建服务器,首先需要一个必备的条件:node必须安装,建议为4.0版本及以上: 在node中,为我们封装了好多类,搭建服务器需要的一个类是"http"类. 用 ...