急!为什么web.xml文件中总有红叉叉??
今天在Myeclipse6.0中建立了一个web工程,但在配置web.xml文件的时候出错了。错误提示:cvc-complex-type.2.4.a:Invalidcon...
今天在Myeclipse6.0中建立了一个web工程,但在配置web.xml文件的时候出错了。错误提示:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://java.sun.com/
xml/ns/javaee":servlet-class, "http://java.sun.com/xml/ns/javaee":jsp-file}' is expected.
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">
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/movie</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<servlet>
<servlet-name>movie-recommender</servlet-name>
<display-name>Movie Recommender</display-name>
<description>Movie recommender servlet</description>
<servlet-class>com.film.servlet.MovieRecommenderServlet</servlet-class>
<init-param>
<param-name>recommender-class</param-name>
<param-value>com.film.recommender.UserBasedRecommender</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>axis</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>user</servlet-name>
<display-name>User Servlet</display-name>
<servlet-class>com.film.servlet.UserServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>movie</servlet-name>
<display-name>Movie Servlet</display-name>
<servlet-class>com.film.servlet.MovieServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>movie-recommender</servlet-name>
<url-pattern>/recommend</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>user</servlet-name>
<url-pattern>/user</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>movie</servlet-name>
<url-pattern>/movies</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
在第15,26,31行的<display-name>地方有红叉
谢谢大家!! 展开
cvc-complex-type.2.4.a: Invalid content was found starting with element 'display-name'. One of '{"http://java.sun.com/
xml/ns/javaee":servlet-class, "http://java.sun.com/xml/ns/javaee":jsp-file}' is expected.
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">
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/movie</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<servlet>
<servlet-name>movie-recommender</servlet-name>
<display-name>Movie Recommender</display-name>
<description>Movie recommender servlet</description>
<servlet-class>com.film.servlet.MovieRecommenderServlet</servlet-class>
<init-param>
<param-name>recommender-class</param-name>
<param-value>com.film.recommender.UserBasedRecommender</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>axis</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>user</servlet-name>
<display-name>User Servlet</display-name>
<servlet-class>com.film.servlet.UserServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>movie</servlet-name>
<display-name>Movie Servlet</display-name>
<servlet-class>com.film.servlet.MovieServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>movie-recommender</servlet-name>
<url-pattern>/recommend</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>user</servlet-name>
<url-pattern>/user</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>movie</servlet-name>
<url-pattern>/movies</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>axis</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
在第15,26,31行的<display-name>地方有红叉
谢谢大家!! 展开
4个回答
展开全部
display-name应该放到sevlet-name上面的
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我也碰到了,display-name只要放到sevlet-name 的上面就不会报错了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个跟ide 有关系.一般不影响程序开发的.
还有可能是项目编码的问题. 编码不统一也会出这情况.
还有可能是项目编码的问题. 编码不统一也会出这情况.
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
文件本身没有问题
可能是IDE自己的问题,可以忽略
可能是IDE自己的问题,可以忽略
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询