servlet在web.xml中进行配置后,挂到服务器时出错
来源:互联网 发布:美团众包辅助软件 编辑:程序博客网 时间:2024/06/01 07:41
开发环境:eclipse+Tomcat
开发语言:HTML+CSS+JavaScript+JSP
1. 打开自己的XXXServlet.Java,删除@WebServlet(“XXXXXX”),并在web.xml中正确配置<servlet>和<servlet-mapping>
2. 打开自己的XXXServlet.java,在public class Servlet extends HttpServlet{ 上面一行添加 @WebServlet(name="XXXServlet" , urlPatterns="/XXXServlet"),并删除web.xml中的所有配置内容。
解释:
目前,Servlet 3.0是Servlet规范的最新版本,其新增了注释的特性,如@WebServlet、@WebFilter、@WebListener等,通过注释就无需在web.xml中进行配置。eclipse中,通过File/New/servlet创建servlet时会自动生成@WebServlet("/XXX"),也就是自动注释了URL地址映射部分。
开发语言:HTML+CSS+JavaScript+JSP
在使用JSP的servlet时,必须对servlet在web.xml中进行<servlet><servlet-mapping>配置,配置形式如下图所示:
当把JSP工程放到服务器上运行时出现如下入错误:
Server at localhost failed to start.
在Console视图中的错误提示如下:
A child container failed during start
cause by Failed to start component
cause by the sarvlet named [x] and [Y] are both mapped to the url [/url] which is not permitted
...........................................................
1. 打开自己的XXXServlet.Java,删除@WebServlet(“XXXXXX”),并在web.xml中正确配置<servlet>和<servlet-mapping>
2. 打开自己的XXXServlet.java,在public class Servlet extends HttpServlet{ 上面一行添加 @WebServlet(name="XXXServlet" , urlPatterns="/XXXServlet"),并删除web.xml中的所有配置内容。
解释:
目前,Servlet 3.0是Servlet规范的最新版本,其新增了注释的特性,如@WebServlet、@WebFilter、@WebListener等,通过注释就无需在web.xml中进行配置。eclipse中,通过File/New/servlet创建servlet时会自动生成@WebServlet("/XXX"),也就是自动注释了URL地址映射部分。
1 0
- servlet在web.xml中进行配置后,挂到服务器时出错
- 在web.xml中配置servlet定义
- 创建Servlet时在web.xml的中配置
- Tomcat7.0后版本无需在web.xml中配置Servlet信息
- Servlet-在web.xml中配置Servlet(Demo)
- servlet通过web.xml配置在服务器启动时自动启动
- web.xml中配置servlet
- web.xml中配置servlet
- servlet中web.xml配置
- web.xml中配置Servlet
- Web.xml中配置Servlet
- servlet中web.xml配置
- 在tomcat5.0中怎样配置web.xml运行servlet
- 在Tomcat5.0中配置web.xml运行servlet
- 怎样在tomcat中配置web.xml运行servlet
- 在web.xml 文件中servlet的配置
- 在web.xml中配置一个注册servlet
- 如何在web.xml中配置servlet定义
- 数据结构实验之查找三:树的种类统计
- Android Dagger2 MVP架构 一看就明白
- 郭晶晶霍启刚夫妇,一股豪门清流
- Hulk
- Android 插件化原理解析——插件加载机制
- servlet在web.xml中进行配置后,挂到服务器时出错
- LeetCode: Count Numbers with Unique Digits
- javaFX
- Mybatis 数据库物理分页插件 PageHelper
- 使用git命令将本地项目上传到Gitlab上
- JZOJ.4678【NOIP2016提高A组8.11】 钱仓
- mysql解决中文是问号的问题+wamp法文显示+wamp不启用
- 1185 威佐夫游戏v2,卡精度,乘法模拟
- 对排序算法的一些总结(python版本)