Web.xml错误解决方法
时间:2010-09-04 来源:sinkingboat
1.servlet书写顺序错误
现象:
The content of element type "servlet" must match "(icon?,servlet-name,display-name?,description?,(servlet-class|jsp-file),init-param*,load-on-startup?,run-as?,security-role-ref*)".
原因:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
要求Servlet的书写顺序必须是
<servlet>
<servlet-name>FilenameListServlet</servlet-name>
<display-name>FilenameListServlet</display-name>
<description>FilenameListServlet</description>
<servlet-class>exam.FilenameListServlet</servlet-class>
</servlet>
而myeclipse自动生成的书写顺序是
<servlet>
<display-name>FilenameListServlet</display-name>
<description>FilenameListServlet</description>
<servlet-name>FilenameListServlet</servlet-name>
<servlet-class>exam.FilenameListServlet</servlet-class>
</servlet>
解决方法:
按web-app_2_3.dtd要求的书写顺序即可。
现象:
The content of element type "servlet" must match "(icon?,servlet-name,display-name?,description?,(servlet-class|jsp-file),init-param*,load-on-startup?,run-as?,security-role-ref*)".
原因:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
要求Servlet的书写顺序必须是
<servlet>
<servlet-name>FilenameListServlet</servlet-name>
<display-name>FilenameListServlet</display-name>
<description>FilenameListServlet</description>
<servlet-class>exam.FilenameListServlet</servlet-class>
</servlet>
而myeclipse自动生成的书写顺序是
<servlet>
<display-name>FilenameListServlet</display-name>
<description>FilenameListServlet</description>
<servlet-name>FilenameListServlet</servlet-name>
<servlet-class>exam.FilenameListServlet</servlet-class>
</servlet>
解决方法:
按web-app_2_3.dtd要求的书写顺序即可。
相关阅读 更多 +