<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"><web-app id="WebApp_ID"><display-name>servyou</display-name> <filter> <filter-name>login</filter-name> <filter-class>servlet.servletfilter</filter-class> </filter> <filter-mapping> <filter-name>login</filter-name> <url-pattern>task.jsp</url-pattern> </filter-mapping> <servlet> <servlet-name>Ser</servlet-name> <display-name>This is the display name of my J2EE component</display-name> <description>This is the description of my J2EE component</description> <servlet-class>servlet.Ser</servlet-class> </servlet> <servlet-name>Ser</servlet-name> <url-pattern>/login</url-pattern> </servlet-mapping> <servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>login.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>如果不增加filter的配置就正确,但是一添加就报错,报错信息为The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime- mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login- config?,security-role*,env-entry*,ejb-ref*)".
2 回答
Caballarii
TA贡献1123条经验 获得超629个赞
<servlet-name>Ser</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
你这里顺序错乱了,注意xml标签的开闭
添加回答
举报
0/150
提交
取消