[英]web.xml the markup in the document following the root element must be well-formed
I'm trying to set up DWR, direct web remoting, and they had me put in the web.xml this piece of code here, 我正在尝试设置DWR,直接进行Web远程处理,他们让我在这里将这段代码放在web.xml中,
<servlet>
<display-name>DWR Servlet</display-name>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.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>
but I get the error the markup in the document following the root element must be well-formed, and it is at the servlet-mapping part. 但是我得到一个错误,即根元素后面的文档中的标记必须格式正确,并且位于servlet映射部分。 I tried putting the servlet mapping inside of servlet and it got rid of the error but the webpage
http://localhost:8081/WebProject01/dwr/
still wouldn't come up. 我尝试将servlet映射放入servlet并摆脱了错误,但是网页
http://localhost:8081/WebProject01/dwr/
仍然无法显示。 The dwr.xml didn't have any errors so that looked good. dwr.xml没有任何错误,所以看起来不错。 Is there another way to fix the error message?
还有另一种方法可以修复错误消息? Thanks for your time.
谢谢你的时间。
<?xml version="1.0" encoding="UTF-8"?>
<servlet>
<display-name>DWR Servlet</display-name>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.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>
is not a valid web.xml
(this is not even valid XML) 不是有效的
web.xml
(甚至不是有效的XML)
The root element of a web.xml is web-app
. web.xml的根元素是
web-app
。 Please refer to the documentation to understand how a web deployment descriptor should look like and what it is for. 请参考文档以了解Web部署描述符的外观以及其用途。
You could edit you web xml in this way: 您可以通过以下方式编辑Web xml:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<servlet>
<display-name>DWR Servlet</display-name>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.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>
version="3.0"
must be support supported by your application server (for example tomcat 7.x) Otherwise pleas look for the corresponding declarations for the servlet spec your app-server implements, for example for 2.5 您的应用程序服务器必须支持
version="3.0"
(例如tomcat 7.x),否则请为您的应用程序服务器实现的servlet规范查找相应的声明, 例如2.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/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.