创建servlet时,web.xml不自动配置,有注释,但访问时报404错误
如题,
HTTP Status 404 - /ServletLifeDemo/Servlet/TestServletOne.
type Status report
message /ServletLifeDemo/Servlet/TestServletOne.
description The requested resource is not available.
Apache Tomcat/7.0.73
如题,
HTTP Status 404 - /ServletLifeDemo/Servlet/TestServletOne.
type Status report
message /ServletLifeDemo/Servlet/TestServletOne.
description The requested resource is not available.
Apache Tomcat/7.0.73
2017-02-06
能贴一下你的web.xml代码吗?
<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name></display-name> <servlet> <description>This is the description of my J2EE component</description> <display-name>This is the display name of my J2EE component</display-name> <servlet-name>LoginServlet</servlet-name> <servlet-class>servlet.LoginServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginServlet</servlet-name> <url-pattern>/servlet/LoginServlet</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>login.jsp</welcome-file> </welcome-file-list> </web-app>
这是我的web.xml里面的内容,你试试复制过去看看,行不?
你所说的xml文件里面的内容没有写,是不是你新建工程的时候就没有xml,要你自己建的?在新建web工程时,不要立刻按finish,按next,把生成web.xml文件勾选上。
举报