我用ECLIPSE新建了一个web project工程,按DWR的文档,修改web.xml文件。内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
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
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
</web-app>
这时问题就出现了,myeclipse在<display-name>DWR Servlet</display-name>这一行出现了一个小红叉叉,提示什么“cvc-complex-type.2.4 a: Invalid content was found starting with element 'desplay-name'...”。
把这个<display-name>DWR Servlet</display-name> 放到第一行就可了,按照(myeclispe的提示顺序)
原文地址:http://dwr.javaeye.com/blog/30839