DWR调用带参数的java方法调试不通,代码如下,求帮忙。
///dwr.xml配置
<?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">
<!-- new意味着DWR应当调用类的默认构造函数 -->
<!-- -->
<create creator="new" javascript="TEST" scope="application">
<!-- -->
<param name="class" value="com.test.ajax.test"/>
<include method="Test"/>
</create>
///JSP页面
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
DWR - Test Home function callTest(){ TEST.Test(callBackForTest); } function callBackTest(data){ //其中date接收方法的返回值 //可以在这里对返回值进行处理和显示等等 alert("the return value is " + data); } function download() { window.location.href = "pad_les.apk"; }
<h1>向服务器发送信息</h1>
<input type="text" id="demo1">
<input type="button" value="提交" onclick="javascript:callTest">
///class
package com.test.ajax;
public class test {
public test(String a) {
System.out.println(a);
}
}