我的环境是  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错误的更多相关文章

  1. Servlet使用注解配置URl提示404错误

    刚接触servlet 3.0,使用注释描述servlet @WebServlet(name="FirstServlet", urlPatterns="/FirstServ ...

  2. c# webapi发布到windows server 2008 r2 iis上提示404错误

    项目服务端是一组RestFul风格的webapi,发布到本机的iis没有问题,但是发布到服务器以后就提示404错误.本机是win10的,服务器是windows server 2008 R2 64位.之 ...

  3. tomcat + jenkins启动tomcat后打开jenkins页面提示404错误的解决方案

    首先下载tomcat和jenkins,将下载的jenkins2.12 war放到tomcat的webapps文件夹下后执行/bin文件夹下的start启动后,打开http://localhost:80 ...

  4. iis7 部署 mvc4项目提示404错误

    1.装了.net framework 4.0框架 2.重新注册了asp.net_iisreg -i 访问mvc项目仍提示404错误 搜了一下,有些服务器还要装个补丁 https://support.m ...

  5. 在使用webstorm打开本地项目文件夹的html文件时,浏览器提示404错误

    错误原因:在使用webstorm打开本地项目文件夹的html文件时,浏览器提示404错误. 错误分析:文件夹命名内包含“+”,此特殊符号导致浏览器解析错误. 改正方案:去掉特殊符号“+”

  6. Servlet --启动时创建、配置url、ServlectContext、初始化参数、获取资源

    servlet的版本的区别 2.5版本, Servlet的配置只支持在xml文件中的配置 3.0版本: Servlet的配置支持在xml文件中的配置, 也可以使用注解的方式, 默认使用注解 让服务器在 ...

  7. Servlet生命周期和注解配置

    Servlet的生命周期和注解配置问题 /* Servlet? 运行在服务器上的小程序 定义浏览器访问到Tomcat的规则 一.生命周期? 1.创建 2.提供服务 3.被销毁 二.servlet3.0 ...

  8. Servlet(二)----注解配置

    ##  Servlet3.0 *  好处: *  支持注解配置.可以不需要web.xml了. *  步骤: 1.创建JavaEE项目,选择Servlet的版本3.0以上,可以不创建web.xml 2. ...

  9. 【Javaweb】Servlet的xml和注解配置

    1.xml <%@ page language="java" contentType="text/html;" %> <!DOCTYPE ht ...

随机推荐

  1. super函数没有那么简单-super原理剖析

    开始之前,先出一道题: #super函数探讨 class A(object): def __init__(self): print 'A.__init__' class B(A): def __ini ...

  2. lsnrctl start 命令未找到 数据库连接报错“ORA-12541: TNS: 无监听程序”

    1. lsnrctl start 命令未找到 或者bash:lsnrctl:command not found. su - oralce        切换用户的时候,中间要有-,而且-的两边有空格, ...

  3. linux下用OCI库访问oracle数据库返回错误Cannot create OCI environment!;

    linux下链接oracle数据库,直接用OCI库函数OCI_Initialize初始化返回Oracle ErrorString:Cannot create OCI environment! 原因是缺 ...

  4. 后PMP时代下的敏捷项目管理全国在线讲座

    活动时间:2017年9月7日(周四)  19:00-21:00 活动形式:在线直播 本次活动免费 互联网经济冲击下,产品创新成为企业生存的关键,"双模"成为很多企业必然的选择,传统 ...

  5. 为Ext添加下拉框和日期组件

    Ext.onReady(function(){ var config = { fields:['module'], data:[['新建'],['删除'],['增加']}; var store = n ...

  6. WebStorm ES6 语法支持设置&babel使用及自动编译

    一.语法支持设置 Preferences > Languages & Frameworks > JavaScript 二.Babel安装 1.全局安装 npm install -g ...

  7. 移动端iOS阻止橡皮筋效果

    一.遇到的问题 移动端开发中,iOS的微信浏览器也好.Safari也好在浏览网页的时候会出现橡皮筋效果.就是当页面拉到尽头的时候还能再继续拉动,露出浏览器的底色,松手会回弹回去. 微信浏览器: Saf ...

  8. IPv4子网掩码回顾

    子网掩码的介绍: IP协议标准规定:每一个使用子网的节点都选择一个32位的位模式,若位模式中的某位置为1,则对应IP地址中的某位就为网络地址(包括网络部分和子网号)中的一位:若位模式中的某位置0,则对 ...

  9. 交换机端口呈现err-disable的原因

    导致交换机端口呈现err-disable状态的原因有很多,为方便大家查询,特归纳如下:   1. duplex mismatch (A is correct) 2. port-channel misc ...

  10. 介绍call和apply

    function add(a, b) { alert(a + b); } function sub(a, b) { alert(a - b); } add.call(sub, 1,3); //4  传 ...