1:導入jra文件dwr.jarjavascript
下載地址:http://jarfiles.pandaidea.com/dwr.htmlhtml
2:dwr.xmljava
<?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">spring
<dwr>
<allow>
<create creator="new" javascript="validator">
<param name="class" value="org.apache.struts2.validators.DWRValidator"/>
</create>
<create creator="new" javascript="Monitor" scope="session">
<param name="class" value="org.springside.core.dwr.DwrService"/>
</create>apache
<!--定義一個create-->
<create creator="new" javascript="CommondSendMonitor" scope="request">
<param name="class" value="com.moving.CommondSend"/>
</create>
</allow>
<signatures>
<![CDATA[
import java.util.Map;
import java.io.InputStream;
import org.apache.struts2.validators.DWRValidator;
import org.springside.core.dwr.DwrService;session
DWRValidator.doPost(String, String, Map<String, String>);
DwrService.setSearchBaseBean(Map<String, String>);
]]>
</signatures>
</dwr>
<!-- END SNIPPET: dwr -->
jsp
3:jsp頁面引入ide
<script src="${ctx }/dwr/interface/CommondSendMonitor.js" type="text/javascript"> </script>idea
4:jsxml
//CommondSend類中定義方法,Map commondSend(String args1,String args2)
CommondSendMonitor.commondSend([args1],[args2],function(sendResult){}