关于对DWR继承测试

超类:
     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 元素 是可以使用继承的。以前不知道~~让我费力不少~~弯路~~~初学者需要注意了~~~
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值