1, dwr.xml configuration
Configuration with 4.1
<dwr> <allow> <create creator="new" javascript="testClass" > <param name="class" value="com.dwr.TestClass" /> <include method="testMethod6"/> </create> <convert converter="bean" match="com.dwr.TestBean"> <param name="include" value="username,password" /> </convert> </allow> </dwr>
Note: If the List, Set or Map of the elements are simple types (including its package type) or String, Date, and the collection of an array type, you do not need to tag <convert>.
2, javascript call (to return to List as an example, List the elements TestBean)
First of all, the introduction of javascript script
Secondly, the preparation of java method call javascript function and receive the return value of callback function
Function callTestMethod6(){
testClass.testMethod6(callBackFortestMethod6);
}
Function callBackFortestMethod6(data){
//其中date接收方法的返回值
//对于JavaBean返回值,有两种方式处理
//不知道属性名称时,使用如下方法
for(var i=0;i<data.length;i++){
for(var property in data){
alert("property:"+property);
alert(property+":"+data[property]);
}
}
//知道属性名称时,使用如下方法
for(var i=0;i<data.length;i++){
alert(data.username);
alert(data.password);
}
} Original: http://i.mop.com/gabriel80/blog/2008/01/10/6075031.html







