通过查看DWR源代码,有了一个解决方案供大家参考,直接上源码啦。
1.修改WEB.XML关于DWR的配置
<!-- dwr. --> <servlet> <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> <init-param> <param-name>activeReverseAjaxEnabled</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>initApplicationScopeCreatorsAtStartup</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>maxWaitAfterWrite</param-name> <param-value>500</param-value> </init-param> <init-param> <param-name>crossDomainSessionSecurity</param-name> <param-value>false</param-value> </init-param> <init-param> <param-name>customConfigurator</param-name> <param-value>com.linkage.util.web.DwrDirConfigurator</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dwr-invoker</servlet-name> <url-pattern>/dwr/*</url-pattern> </servlet-mapping>
2.添加com.linkage.util.web.DwrDirConfigurator java实现类
--------------------------------------------------------
官方提供的多配置文件加载方式:
<init-param> <param-name>config-system</param-name> <param-value>/WEB-INF/classes/dwr/dwr-system.xml</param-value> </init-param> <init-param> <param-name>config-grid</param-name> <param-value>/WEB-INF/classes/dwr/dwr-grid.xml</param-value> </init-param> <init-param> <param-name>config-gisPlatform</param-name> <param-value>/WEB-INF/classes/dwr/dwr-gisPlatform.xml</param-value> </init-param> <init-param> <param-name>config-spring</param-name> <param-value>/WEB-INF/classes/dwr/dwr-spring.xml</param-value> </init-param>原文链接:https://www.f2er.com/ajax/165732.html