我的环境是  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. tensorflow笔记(四)之MNIST手写识别系列一

    tensorflow笔记(四)之MNIST手写识别系列一 版权声明:本文为博主原创文章,转载请指明转载地址 http://www.cnblogs.com/fydeblog/p/7436310.html ...

  2. shell 多进程

    shell 多进程来模拟多线程 (1){ } 建立代码块 (2)使用 & 将进程放入后台 [zheng@localhost ~]$ cat threads.sh #!/bin/bash ;i& ...

  3. 关于Yii2的checkboxList的初始选项设置问题

    先在网上找了个checkboxList的描述: public static function checkboxList($name, $selection = null, $items = [], $ ...

  4. WeQuant交易策略—Chaikin A/D

    策略名称:AD指标策略 多空双方力量浮标- AD(Chaikin A/D线)策略关键词:ChaikinA/D线.多空对比.AD指标是一种非常流行的平横交易量指标, 用于估定一段时间内该证券累积的资金流 ...

  5. HTML Input属性

    HTML Input 属性 value 属性 value 属性规定输入字段的初始值: readonly 属性 readonly 属性规定输入字段为只读(不能修改): readonly 属性不需要值.它 ...

  6. Webpack+Vue+ES6 前端组件化开发mobile-multi-page应用实战总结

    本文版权归博客园和作者吴双本人共同所有 转载和爬虫请注明原文地址 www.cnblogs.com/tdws 一.写在前面 项目上线有一段时间了,一个基于webpack+vue+ES6的手机端多页面应用 ...

  7. 代码精简之Lombok

    JavaWeb项目开发中,JavaBean总是不可避免的出现,随之而来的就是大量的getter.setter方法,虽然大部分的开发工具(比如Eclipse等)都支持自动生成这些东西,但是一旦Bean里 ...

  8. UIImageView动画制作

    1.先初始化一个UIImageView的视图窗口 如:anima UIImageView *anima = [UIImageView alloc]initWithFrame(0,0,100,100); ...

  9. ROS学习记录(二)————使用smartcar进行仿真(用.xacro文件来运行rviz)

    我发现一个学习ROS系统的好网站: 创客智造http://www.ncnynl.com/ 这里面关于ROS的各个方面都有很详细的介绍. 这周,不,上周我对整个ROS是绝望的,我用一个一个下午的时间在敲 ...

  10. 第1阶段——uboot分析之硬件初始化start_armboot函数(5)

    start_armboot()分析:在start.S初始化后跳转到start_armboot实现第2阶段硬件相关的初始化(烧写擦除flash,网卡驱动,usb驱动,串口驱动,从FLASH读内核,启动内 ...