在JEE配置web.xml中的servlet问题

在web.xml当中,要注意,最后路径的是否被识别!!!!

要是发布项目后进入404

web.xml当中的路径,将其修改为:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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>reg_login</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>
  <servlet>
    <description></description>
    <display-name>InitServlet</display-name>
    <servlet-name>InitServlet</servlet-name>
    <servlet-class>com.imooc.servlet.InitServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
      <servlet-name>InitServlet</servlet-name>
      <url-pattern>/*/InitServlet</url-pattern>     注意这里!!!!!!
  </servlet-mapping>

</web-app>

猜你喜欢

转载自www.cnblogs.com/jhl123/p/8862299.html