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);
}
}
<input type="button" value="提交" onclick="javascript:callTest">
你調js 方法 callTest() 程序識別不出來,要加上括號
<input type="button" value="提交" onclick="javascript:callTest()">