工程文件结构
项目中配置多个DWR文件,其实就是配置多个DWR的servlet,并且给每个servlet配置dwr的映射文件;
注意:<param-name>config******</param-name>每个配置的param-nam的值必须是以 config 开头;
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 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"> <display-name>testDwr</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <!-- ①##后端 DWR --> <!-- Dwr核心Servlet --> <servlet> <servlet-name>dwrAdmin</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>config-admin</param-name> <param-value>WEB-INF/dwr_xml/admin.xml</param-value> </init-param> </servlet> <!-- Dwr核心Servlet Url映射--> <servlet-mapping> <servlet-name>dwrAdmin</servlet-name> <url-pattern>/adminUrl/*</url-pattern> </servlet-mapping> <!-- ##前端 DWR --> <!-- Dwr核心Servlet --> <servlet> <servlet-name>dwrFace</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>config-face</param-name> <param-value>WEB-INF/dwr_xml/face.xml</param-value> </init-param> </servlet> <!-- Dwr核心Servlet Url映射--> <servlet-mapping> <servlet-name>dwrFace</servlet-name> <url-pattern>/faceUrl/*</url-pattern> </servlet-mapping> </web-app>