DWR简单 实现单向聊天【文章一:配置问题】 功能登录显示登录用户【无数据库操作】

开始工作一: 需导入开发包 commons-logging-1.0.4.jar 、log4j-1.2.11.jar 、dwr.jar 二:在web.xml 中配置如下:
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
	<servlet>
		<servlet-name>dwr-invoke</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>
               org.directwebremoting.event.ScriptSessionListener
			</param-name>
			<param-value>
				com.dwr.ScriptSessionListenerImpl
			</param-value>
		</init-param>


		<init-param>
			<param-name>
				*
			</param-name>
			<param-value>*</param-value>
		</init-param>
		<load-on-startup>0</load-on-startup>
	</servlet>
  <servlet>
    <description>This is the description of my J2EE component</description>
    <display-name>This is the display name of my J2EE component</display-name>
    <servlet-name>ExitGameServlet</servlet-name>
    <servlet-class>com.servlets.ExitGameServlet</servlet-class>
  </servlet>




	<servlet-mapping>
		<servlet-name>dwr-invoke</servlet-name>
		<url-pattern>/dwr/*</url-pattern>
	</servlet-mapping>
  <servlet-mapping>
    <servlet-name>ExitGameServlet</servlet-name>
    <url-pattern>/ExitGameServlet</url-pattern>
  </servlet-mapping>


</web-app>


  DWR.XML的配置
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN" "http://getahead.org/dwr//dwr30.dtd">

<dwr>
	<allow>
		<convert match="com.vo.User" converter="bean"></convert>
		<create javascript="myjs" creator="new">
			<param name="class"
				value="com.dwr.ChatDwr">
			</param>
		</create>

     </allow>
</dwr>



你可能感兴趣的:(log4j,Web,xml,servlet,DWR)