关于对DWR继承测试
2006-10-08 15:25
387 查看
超类:
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>
执行结果:
In addition there is an optional utility 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( );
var reply0 = function(data)
{
if (data != null && typeof data == 'object') alert(DWRUtil.toDescriptiveString(data, 2));
else DWRUtil.setValue('d0', DWRUtil.toDescriptiveString(data, 1));
}
25
Myname( );
var reply1 = function(data)
{
if (data != null && typeof data == 'object') alert(DWRUtil.toDescriptiveString(data, 2));
else DWRUtil.setValue('d1', DWRUtil.toDescriptiveString(data, 1));
}
haoxiaojie
结论:
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( );
var reply0 = function(data)
{
if (data != null && typeof data == 'object') alert(DWRUtil.toDescriptiveString(data, 2));
else DWRUtil.setValue('d0', DWRUtil.toDescriptiveString(data, 1));
}
25
Myname( );
var reply1 = function(data)
{
if (data != null && typeof data == 'object') alert(DWRUtil.toDescriptiveString(data, 2));
else DWRUtil.setValue('d1', DWRUtil.toDescriptiveString(data, 1));
}
haoxiaojie
结论:
DWR中的create 元素 是可以使用继承的。以前不知道~~让我费力不少~~弯路~~~初学者需要注意了~~~
相关文章推荐
- 关于接口,继承,内部类的一些测试
- hibernate自定义主键生成策略2---关于Configurable接口继承和PersistentIdentifierGenerator常量的测试
- [MFC学习之C++基础] 孙鑫视频中第三讲中提到的小测试程序(关于基类和子类的继承关系)
- 关于类的继承测试程序
- 关于继承的方式测试
- 关于相等测试与继承+Hashcode+toString ,求指导!
- 关于dwr的简单测试
- 关于DWR中WebContextFactory的测试(学习中ing~~~~)
- 关于SQL主键用int还是varchar类型的一个小测试
- 一组关于SQLAnywhere12和MongoDB的benchMark测试(写操作)
- (面向对象一)关于继承和组合的区别
- 关于thinkphp部署到新浪云模板继承失效的问题
- 关于C#数组初始化的效率测试
- 关于继承问题初始化的问题
- 关于C++继承的一些遗忘细节
- 关于eclipse使用中,真机测试无法打开File Explorer中data目录无法打开的问题
- Java实践(四)---关于继承设计的一些技巧
- 转载一篇关于软件测试的博客,方便以后查找。
- 泛型的继承测试
- 关于软件质量和软件测试的一点点看法 zz