1.将DWR 放入你的工程
1)从官方网站(http://getahead.org/dwr/download)下载dwr.jar包。然后将它放在你webapp的WEB-INF/lib目录下。
2)将下载的dwr.jarorgdirectwebremoting内的engine.js和util.js放入WEB 应用中,比如js 文件夹下(可选)
2 编辑配置文件
1)web.xml
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>allowScriptTagRemoting</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<description>ReverseAjaxEnabled</description>
<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>100</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
2)集成spring的时候spring-config.xml配置
<!--DWR 配置BEGIN -->
<!-- 启动 DWR 注解配置模式-->
<dwr:configuration >
<dwr:converttype="exception" class="java.lang.Exception">
<dwr:includemethod="message"/>
</dwr:convert>
</dwr:configuration>
<dwr:annotation-configid="dwrid"/>
<dwr:url-mapping />
<!-- 开启dubug状态-->
<dwr:controller debug="true"/>
<!-- DWR 配置END-->