我用jb2005打开工程里的web.xml时候,出现很多这个错误,这个到底是什么错误呢??
9 个解决方案
#1
你把工程下的所有class文件,和缓存文件全部删除,然后重新编译!
要手工删除!
如果还是不行,就就另外写一个web.xml文件,拷贝到wen-inf目录下,覆盖原来的那个!
试下!
要手工删除!
如果还是不行,就就另外写一个web.xml文件,拷贝到wen-inf目录下,覆盖原来的那个!
试下!
#2
还是有这个错误
我的web.xml
-----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"
>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<display-name>JSP</display-name>
<description>
JSP
</description>
<filter>
<filter-name>managerAuth</filter-name>
<filter-class>com.jspdev.filter.ManagerFilter</filter-class>
<init-param>
<param-name>manager</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.jspdev.ch8.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter>
<filter-name>auth</filter-name>
<filter-class>com.jspdev.filter.SignonFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>managerAuth</filter-name>
<url-pattern>/manage1/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>ViewMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.ViewMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>TestServletConfig</servlet-name>
<servlet-class>com.jspdev.servlet.test.TestServletConfig</servlet-class>
</servlet>
<servlet>
<servlet-name>AddMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.AddMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>forumservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ForumServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>newtopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.NewTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>edittopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.EditTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>deletetopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.DeleteTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>replytopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ReplyTopicServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewMessageServlet</servlet-name>
<url-pattern>/viewMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddMessageServlet</servlet-name>
<url-pattern>/addMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServletConfig</servlet-name>
<url-pattern>/servlet/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>forumservlet</servlet-name>
<url-pattern>/servlet/forumservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>newtopicservlet</servlet-name>
<url-pattern>/servlet/newtopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>edittopicservlet</servlet-name>
<url-pattern>/servlet/edittopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>deletetopicservlet</servlet-name>
<url-pattern>/servlet/deletetopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>replytopicservlet</servlet-name>
<url-pattern>/servlet/replytopicservlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://hellking.com/function</taglib-uri>
<taglib-location>/WEB-INF/functions.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
</web-app>
我的web.xml
-----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"
>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<display-name>JSP</display-name>
<description>
JSP
</description>
<filter>
<filter-name>managerAuth</filter-name>
<filter-class>com.jspdev.filter.ManagerFilter</filter-class>
<init-param>
<param-name>manager</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.jspdev.ch8.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter>
<filter-name>auth</filter-name>
<filter-class>com.jspdev.filter.SignonFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>managerAuth</filter-name>
<url-pattern>/manage1/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>ViewMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.ViewMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>TestServletConfig</servlet-name>
<servlet-class>com.jspdev.servlet.test.TestServletConfig</servlet-class>
</servlet>
<servlet>
<servlet-name>AddMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.AddMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>forumservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ForumServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>newtopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.NewTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>edittopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.EditTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>deletetopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.DeleteTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>replytopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ReplyTopicServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewMessageServlet</servlet-name>
<url-pattern>/viewMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddMessageServlet</servlet-name>
<url-pattern>/addMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServletConfig</servlet-name>
<url-pattern>/servlet/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>forumservlet</servlet-name>
<url-pattern>/servlet/forumservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>newtopicservlet</servlet-name>
<url-pattern>/servlet/newtopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>edittopicservlet</servlet-name>
<url-pattern>/servlet/edittopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>deletetopicservlet</servlet-name>
<url-pattern>/servlet/deletetopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>replytopicservlet</servlet-name>
<url-pattern>/servlet/replytopicservlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://hellking.com/function</taglib-uri>
<taglib-location>/WEB-INF/functions.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
</web-app>
#3
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
这里这样写试试
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
这里这样写试试
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
#4
楼上的大哥,像你所说的那么改后 出现了以下错误:
src-resolve: Cannot resolve the name 'j2ee:jsp-configType' to a(n) type definition component.
src-resolve: Cannot resolve the name 'j2ee:jsp-fileType' to a(n) type definition component.
cvc-complex-type.2.4.a: Invalid content starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.
src-resolve: Cannot resolve the name 'j2ee:jsp-configType' to a(n) type definition component.
src-resolve: Cannot resolve the name 'j2ee:jsp-fileType' to a(n) type definition component.
cvc-complex-type.2.4.a: Invalid content starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.
#5
楼主这样改把
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
改成
<web-app>
一切OK
:)
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
改成
<web-app>
一切OK
:)
#6
大哥
改成<web-app>会出现,如下错误两处:
Element type "jsp-config" must be declared.
The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
改成<web-app>会出现,如下错误两处:
Element type "jsp-config" must be declared.
The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
#7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
。。。。。
。。。。。
</web-app>
----------------
这个是我的呀,<web-app>节点里边根本就没有那么多的参数呀,直接去掉,应该不会有问题,!
如果有什么警告,你不要理会,看程序能不能编译的通!
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
。。。。。
。。。。。
</web-app>
----------------
这个是我的呀,<web-app>节点里边根本就没有那么多的参数呀,直接去掉,应该不会有问题,!
如果有什么警告,你不要理会,看程序能不能编译的通!
#8
看一看web-inf目录下面,一般会有一个web-app_*_*.dtd类似的文件,把你的web-app_2_4.dtd替换成那个估计就可以了,
#9
改成那样“<web-app>”,编译出现很多错误
在web-inf目录下也没有类似web-app_*_*.dtd的文件
那么现在应该怎么做啊??????????????
在web-inf目录下也没有类似web-app_*_*.dtd的文件
那么现在应该怎么做啊??????????????
#1
你把工程下的所有class文件,和缓存文件全部删除,然后重新编译!
要手工删除!
如果还是不行,就就另外写一个web.xml文件,拷贝到wen-inf目录下,覆盖原来的那个!
试下!
要手工删除!
如果还是不行,就就另外写一个web.xml文件,拷贝到wen-inf目录下,覆盖原来的那个!
试下!
#2
还是有这个错误
我的web.xml
-----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"
>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<display-name>JSP</display-name>
<description>
JSP
</description>
<filter>
<filter-name>managerAuth</filter-name>
<filter-class>com.jspdev.filter.ManagerFilter</filter-class>
<init-param>
<param-name>manager</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.jspdev.ch8.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter>
<filter-name>auth</filter-name>
<filter-class>com.jspdev.filter.SignonFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>managerAuth</filter-name>
<url-pattern>/manage1/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>ViewMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.ViewMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>TestServletConfig</servlet-name>
<servlet-class>com.jspdev.servlet.test.TestServletConfig</servlet-class>
</servlet>
<servlet>
<servlet-name>AddMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.AddMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>forumservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ForumServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>newtopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.NewTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>edittopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.EditTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>deletetopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.DeleteTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>replytopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ReplyTopicServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewMessageServlet</servlet-name>
<url-pattern>/viewMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddMessageServlet</servlet-name>
<url-pattern>/addMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServletConfig</servlet-name>
<url-pattern>/servlet/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>forumservlet</servlet-name>
<url-pattern>/servlet/forumservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>newtopicservlet</servlet-name>
<url-pattern>/servlet/newtopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>edittopicservlet</servlet-name>
<url-pattern>/servlet/edittopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>deletetopicservlet</servlet-name>
<url-pattern>/servlet/deletetopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>replytopicservlet</servlet-name>
<url-pattern>/servlet/replytopicservlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://hellking.com/function</taglib-uri>
<taglib-location>/WEB-INF/functions.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
</web-app>
我的web.xml
-----------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"
>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
<display-name>JSP</display-name>
<description>
JSP
</description>
<filter>
<filter-name>managerAuth</filter-name>
<filter-class>com.jspdev.filter.ManagerFilter</filter-class>
<init-param>
<param-name>manager</param-name>
<param-value>0</param-value>
</init-param>
</filter>
<filter>
<filter-name>encoding</filter-name>
<filter-class>com.jspdev.ch8.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>gb2312</param-value>
</init-param>
</filter>
<filter>
<filter-name>auth</filter-name>
<filter-class>com.jspdev.filter.SignonFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>managerAuth</filter-name>
<url-pattern>/manage1/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>ViewMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.ViewMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>login</servlet-name>
<jsp-file>/index.jsp</jsp-file>
</servlet>
<servlet>
<servlet-name>TestServletConfig</servlet-name>
<servlet-class>com.jspdev.servlet.test.TestServletConfig</servlet-class>
</servlet>
<servlet>
<servlet-name>AddMessageServlet</servlet-name>
<servlet-class>com.jspdev.ch9.AddMessageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>forumservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ForumServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>newtopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.NewTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>edittopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.EditTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>deletetopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.DeleteTopicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>replytopicservlet</servlet-name>
<servlet-class>com.jspdev.servlet.ReplyTopicServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewMessageServlet</servlet-name>
<url-pattern>/viewMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AddMessageServlet</servlet-name>
<url-pattern>/addMessages_servlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>TestServletConfig</servlet-name>
<url-pattern>/servlet/test</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>forumservlet</servlet-name>
<url-pattern>/servlet/forumservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>newtopicservlet</servlet-name>
<url-pattern>/servlet/newtopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>edittopicservlet</servlet-name>
<url-pattern>/servlet/edittopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>deletetopicservlet</servlet-name>
<url-pattern>/servlet/deletetopicservlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>replytopicservlet</servlet-name>
<url-pattern>/servlet/replytopicservlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://hellking.com/function</taglib-uri>
<taglib-location>/WEB-INF/functions.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt-rt</taglib-uri>
<taglib-location>/WEB-INF/fmt-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
<taglib-location>/WEB-INF/c-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
<taglib-location>/WEB-INF/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/sql-rt</taglib-uri>
<taglib-location>/WEB-INF/sql-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>
<taglib-location>/WEB-INF/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/x-rt</taglib-uri>
<taglib-location>/WEB-INF/x-rt.tld</taglib-location>
</taglib>
</web-app>
#3
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
这里这样写试试
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
这里这样写试试
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
#4
楼上的大哥,像你所说的那么改后 出现了以下错误:
src-resolve: Cannot resolve the name 'j2ee:jsp-configType' to a(n) type definition component.
src-resolve: Cannot resolve the name 'j2ee:jsp-fileType' to a(n) type definition component.
cvc-complex-type.2.4.a: Invalid content starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.
src-resolve: Cannot resolve the name 'j2ee:jsp-configType' to a(n) type definition component.
src-resolve: Cannot resolve the name 'j2ee:jsp-fileType' to a(n) type definition component.
cvc-complex-type.2.4.a: Invalid content starting with element 'taglib'. One of '{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name, "http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":distributable, "http://java.sun.com/xml/ns/j2ee":context-param, "http://java.sun.com/xml/ns/j2ee":filter, "http://java.sun.com/xml/ns/j2ee":filter-mapping, "http://java.sun.com/xml/ns/j2ee":listener, "http://java.sun.com/xml/ns/j2ee":servlet, "http://java.sun.com/xml/ns/j2ee":servlet-mapping, "http://java.sun.com/xml/ns/j2ee":session-config, "http://java.sun.com/xml/ns/j2ee":mime-mapping, "http://java.sun.com/xml/ns/j2ee":welcome-file-list, "http://java.sun.com/xml/ns/j2ee":error-page, "http://java.sun.com/xml/ns/j2ee":jsp-config, "http://java.sun.com/xml/ns/j2ee":security-constraint, "http://java.sun.com/xml/ns/j2ee":login-config, "http://java.sun.com/xml/ns/j2ee":security-role, "http://java.sun.com/xml/ns/j2ee":env-entry, "http://java.sun.com/xml/ns/j2ee":ejb-ref, "http://java.sun.com/xml/ns/j2ee":ejb-local-ref, "http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":message-destination, "http://java.sun.com/xml/ns/j2ee":locale-encoding-mapping-list}' is expected.
#5
楼主这样改把
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
改成
<web-app>
一切OK
:)
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4">
改成
<web-app>
一切OK
:)
#6
大哥
改成<web-app>会出现,如下错误两处:
Element type "jsp-config" must be declared.
The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
改成<web-app>会出现,如下错误两处:
Element type "jsp-config" must be declared.
The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
#7
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
。。。。。
。。。。。
</web-app>
----------------
这个是我的呀,<web-app>节点里边根本就没有那么多的参数呀,直接去掉,应该不会有问题,!
如果有什么警告,你不要理会,看程序能不能编译的通!
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
。。。。。
。。。。。
</web-app>
----------------
这个是我的呀,<web-app>节点里边根本就没有那么多的参数呀,直接去掉,应该不会有问题,!
如果有什么警告,你不要理会,看程序能不能编译的通!
#8
看一看web-inf目录下面,一般会有一个web-app_*_*.dtd类似的文件,把你的web-app_2_4.dtd替换成那个估计就可以了,
#9
改成那样“<web-app>”,编译出现很多错误
在web-inf目录下也没有类似web-app_*_*.dtd的文件
那么现在应该怎么做啊??????????????
在web-inf目录下也没有类似web-app_*_*.dtd的文件
那么现在应该怎么做啊??????????????