超类:
public class Father {
public Father() {
}
public String Myname(){
return "haoxiaojie";
}
} // end
子类:
public class Test_ajax extends Father{
public Test_ajax() {
}
public String myage(){
return "25";
}
} // end
在dwr.xml中的声明:
<create creator="new" javascript="tomajax" scope="request">
<param name="class" value="hxj.tgtc.actions.dwr.Test_ajax"></param>
<include method="Myname"/>
<include method="myage"/>
</create>
执行结果:
DWR中的create 元素 是可以使用继承的。以前不知道~~让我费力不少~~弯路~~~初学者需要注意了~~~
public class Father {
public Father() {
}
public String Myname(){
return "haoxiaojie";
}
} // end
子类:
public class Test_ajax extends Father{
public Test_ajax() {
}
public String myage(){
return "25";
}
} // end
在dwr.xml中的声明:
<create creator="new" javascript="tomajax" scope="request">
<param name="class" value="hxj.tgtc.actions.dwr.Test_ajax"></param>
<include method="Myname"/>
<include method="myage"/>
</create>
执行结果:
Methods For: tomajax (hxj.tgtc.actions.dwr.Test_ajax)
To use this class in your javascript you will need the following script includes:
<script type='text/javascript' src='/tgtc/dwr/interface/tomajax.js'></script>
<script type='text/javascript' src='/tgtc/dwr/engine.js'></script>
In addition there is an optional utility script:
<script type='text/javascript' src='/tgtc/dwr/util.js'></script>
Replies from DWR are shown with a yellow background if they are simple or in an alert box otherwise.
The inputs are evaluated as Javascript so strings must be quoted before execution.
There are 11 declared methods:
- myage( ); 25
- Myname( ); haoxiaojie
DWR中的create 元素 是可以使用继承的。以前不知道~~让我费力不少~~弯路~~~初学者需要注意了~~~