日期:2014-05-16  浏览次数:20646 次

ajax运用dwr工具来从前台页面值传递到后台Java对象里面(回钦波个人总结)
1.java类 public class DwrTest4{ public void addOrUpdateHuiqinbo(int userId,int sn,boolean yes){ System.out.println("userId="+userId+",sn="+sn+",yes="+yes); } } 2.dwr.xml <dwr><allow><create creator="new" javascript="test4"><param name="class" value="com.yezhong.oa.dwr.DwrTest4"></create></allow></dwr> 3.test4.jsp页面 <script type="text/javascript" src="dwr/engine.js"></script><script type="text/javascript" src="dwr/util.js"></script><script type="text/javascript" src="dwr/interface/test4.js"></script><script type="text/javascript"> function test1(r){ test4.addOrUpdatePermission( r.userId, r.resourceSn, r.checked ); } function test2(){ test4.addOrUpdatePermission( ${"t"}.userId, ${"t"}.resourceSn, ${"t"}.checked ); } </script><!--也可以这样表示 <input userId="234" resourceSn="579" type="checkbox" name="t" onclick="test2()"/> -->