1. Add dwr.jar files in the web-inf/lib/directory
2. Configure the servlet dwrservlet in the Web.xml file
<!--configuration Dwr-->
<servlet>
<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 >
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
Add dwr.xml files to the web-inf/directory
<?xml version= "1.0" encoding= "UTF-8"?> <!
DOCTYPE dwr Public "-//getahead limited//dtd Direct Web Remoting 2.0//en" "Http://getahead.org/dwr/dwr20.dtd" >
& lt;dwr>
<allow>
<!--JavaScript is configured to
write Userdwr.save () in the alias of the Bean when using the JS code to access the bean; Just as the UserService-bound class Userserviceimpl
invokes the Save method, which is Userserviceimpl.save ();
-->
<create creator= "Spring" javascript= "Userdwr" >
<!--value is the ID of the bean configured in the Spring container-->
<param name= "Beanname" value= "UserService"/>
</create>
<!--DWR only supports JSON data formats, So in DWR we have to read the attributes in JavaBean, we have to convert them to
JSON data format, which is the UserInfo data conversion
-->
<convert match= " Com.hsit.pojo.Userinfo "converter=" Bean >
<!--If you have a property that you don't want to take out, you exclude it, name Exclude,value is the name of the attribute you want to exclude-->
<param name= "exclude" value= "dept" ></param>
</convert>
</allow>
</dwr>