日期:2014-05-20 浏览次数:20732 次
<%@ page language="java" contentType="text/html; charset=GBK" %> <% String path = request.getContextPath(); %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=GBK"> <title>First DWR</title> <script type="text/javascript" src="<%=path%>/dwr/engine.js"></script> <script type="text/javascript" src="<%=path%>/dwr/util.js"></script> <script type="text/javascript" src="<%=path%>/dwr/interface/Hello.js"></script> <script language="javascript"> function hello() { var userValue = dwr.util.getValue("user"); //获取参数方法1 alert("使用Dwr框架取得Html 参数的值>"+userValue); Hello.hello(userValue,ccc);//这里的hello是Hello类中的方法 alert("使用Dwr框架取得Html 参数的值>"+userValue); } //ccc回调方法Date返回的数据 function ccc(data){ alert("Hello. hello 返回值"+data); alert("Dwr 框架 重新构建HTML web"+data); dwr.util.setValue("responseDiv",data); } </script> </head> <body> <input id="user" name="user222" type="text" value="ddd" /> <input type="button" value="HELLO" onclick="hello();" /> <hr/> <div id="responseDiv"></div> </body> </html>