1.创建一个Web Project项目,导入dwr.jar包。
- @H_502_17@<?xmlversion="1.0"encoding="UTF-8"?>
- @H_502_17@<web-appversion="2.5"
- @H_502_17@xmlns="http://java.sun.com/xml/ns/javaee"
- @H_502_17@xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- @H_502_17@xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- @H_502_17@http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
- @H_502_17@<!--dwr核心servlet-->
- @H_502_17@<listener>
- @H_502_17@<listener-class>org.directwebremoting.servlet.DwrListener</listener-class>
- @H_502_17@</listener>
- @H_502_17@<servlet>
- @H_502_17@<!--dwr核心servelt实现类-->
- @H_502_17@<servlet-name>dwr</servlet-name>
- @H_502_17@<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
- @H_502_17@<!--设置dwr可调式-->
- @H_502_17@<init-param>
- @H_502_17@<param-name>debug</param-name>
- @H_502_17@<param-value>true</param-value>
- @H_502_17@</init-param>
- @H_502_17@<!--设置ajax的反向技术-->
- @H_502_17@<init-param>
- @H_502_17@<param-name>activeReverseAjaxEnabled</param-name>
- @H_502_17@<param-value>true</param-value>
- @H_502_17@</init-param>
- @H_502_17@<param-name>initApplicationScopeCreatorsAtStartip</param-name>
- @H_502_17@<!--长连接时保持时间-->
- @H_502_17@<param-name>maxWaitAfterWrite</param-name>
- @H_502_17@<param-value>60</param-value>
- @H_502_17@<load-on-startup>1</load-on-startup>
- @H_502_17@</servlet>
- @H_502_17@<servlet-mapping>
- @H_502_17@<url-pattern>/dwr/*</url-pattern>
- @H_502_17@</servlet-mapping>
- @H_502_17@<welcome-file-list>
- @H_502_17@<welcome-file>index.jsp</welcome-file>
- @H_502_17@</welcome-file-list>
- @H_502_17@</web-app>
3.创建一个SendingMessage.java类
copy