DWR 随笔之二

须spring2.0以上:
dwr.xml 配置代码;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
           http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-2.0.xsd" >
	<!-- DWR核心配置-->
	<dwr:configuration>
<dwr:convert type="bean" class="com.dwr.demo.web.*">
</dwr:convert>
</dwr:configuration>
<bean name="userdwr"
class="com.dwr.demo.web.testAction">
<dwr:remote javascript="UserDwr">
 <dwr:include method="login"/><!---校验登录名称-->
<dwr:include method="checkOldpwd" /> <!--校验密码-->
</dwr:remote>
</bean>	
</beans>

web.xml ;配置代码

<!--    DWR(Direct Web Remoting)  -->
<servlet>
<servlet-name>DWRSPRING</servlet-name>
<servlet-class>
org.directwebremoting.spring.DwrSpringServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DWRSPRING</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<!--  **************************** -->

taglibs.jsp 配置代码:

<script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript'src='dwr/interface/UserDwr.js'>
</script>

你可能感兴趣的:(java,spring,xml,Web,DWR)