使用注解配置servlet6
来源:互联网 发布:消费观念 知乎 编辑:程序博客网 时间:2024/05/29 13:00
metadata-complete属性指定是否启用注解和web模块:
无指定或者false启用;反之。。。
只有Servlet类在web-inf/classes目录中或者打包到位于web-inf/lib的jar文件才起作用
<?xml version="1.0" encoding="UTF-8"?><web-app metadata-complete="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>project5</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list></web-app>
metadata-complete=”false”
@WebServlet(name = "servlet1", initParams = { @WebInitParam(name = "name1", value = "value1") }, urlPatterns = "/servlet1",loadOnStartup=1,asyncSupported=true)public class Servlet1 extends HttpServlet {。。。。。。。。。}
value与urlpattern不能同时给,否则启动就要报错
urlpattern不能与web.xml中配置的重复
属性名 类型 属性描述
name String 指定servlet的name属性,等价于.如果没有显示指定,则该servlet的取值即为类的全限定名.
value String[] 等价于urlPatterns,二者不能共存.
urlPatterns String[] 指定一组servlet的url的匹配模式,等价于标签.
loadOnStartup int 指定servlet的加载顺序,等价于标签.
initParams WebInitParam[] 指定一组初始化参数,等价于标签.
asyncSupported boolean 申明servlet是否支持异步操作模式,等价于标签.
displayName String servlet的显示名,等价于标签.
description String servlet的描述信息,等价于标签.
阅读全文
0 0
- 使用注解配置servlet6
- servlet6
- Mybatis使用 注解配置
- ButterKnife注解使用配置
- 使用注解配置spring
- 使用注解配置spring
- 使用注解配置spring aop
- hibernate使用注解配置过程
- 使用butterknife注解工程配置
- struts2 使用注解方式配置
- SpringMVC使用注解配置AOP
- Hibernate使用注解配置映射
- 使用注解配置Spring AOP
- spring security3 配置使用注解
- 使用注解来配置MyBatis
- Struts2使用19 -- 注解配置1 -- Action注解配置
- servlet6-异常处理
- Spring 使用注解配置使用ehcache
- bootstrap glyphicon无法显示问题
- [日推荐]『爱比趣』有意思的体育社区
- Java并发编程与技术内幕:线程池深入理解
- 博弈——涂色游戏
- JMeter-断言
- 使用注解配置servlet6
- 爬虫记录(2)——简单爬取一个页面的图片并保存
- AndroidASD完全解析02之TextInputLayout
- springmvc页面报404错误解决
- UUID算法分析
- Qt Creater error 转换到 COFF 期间失败
- Linux之 find之 ctime,atime,mtime
- Java并发编程与技术内幕:Callable、Future、FutureTask、CompletionService
- 资源整合平台汇总