日期:2014-05-16 浏览次数:20673 次
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<description>Direct Web Remoter Servlet</description>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<dwr>
<allow>
<create creator="new" javascript="showAll">
<param name="class" value="com.ljt.db.ShowAll"/>
</create>
</allow>
</dwr>
package com.ljt.db;
public class ShowAll {
public long getAll(){
long info=10;
return info;
}
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>DWR - Test Home</title>
<script type='text/javascript' src='/db/dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<script type='text/javascript' src='js/jquery-1.3.2.min.js'></script>
<script type='text/javascript' src='/db/dwr/interface/showAll.js'></script>
<script type="text/javascript">
var allname;
function allNum()
{
dwr.engine.setAsync(false);
showAll.getAll( function(data)
{
dwr.util.setValue("textname", data);
allname=data;
});
alert(allname);
dwr.engine.setAsync(true);
}
</script>
</head>
<body >
<div>