DWR+S2SH

任务:将DWR整合到S2SH环境中
步骤:
            1·导入dwr.jar以及依赖包commons.logging.jar
            2·在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>
    <init-param>
      <param-name>activeReverseAjaxEnabled</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>
        3·在web.xml同级目录下添加dwr.xml,内容如下:
<!DOCTYPE dwr PUBLIC
    "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN"
    "http://getahead.org/dwr/dwr30.dtd">
<dwr>
  <allow>
  	
  </allow>
</dwr
        4·在struts.xml中添加如下代码( 防止struts2与dwr过滤冲突):
<constant name="struts.action.excludePattern" value="/dwr/.*,/dwr/test/.*" />
        5·DWR中创建转换对象的方式如下:
<create creator="spring"  javascript="demoService" >
  <param name="beanName"  value="demoService"  ></param>
</create>

你可能感兴趣的:(DWR+S2SH)