读书人

ExtDirectSpring的用法1

发布时间: 2012-08-28 12:37:01 作者: rapoo

ExtDirectSpring的用法一
环境搭建好以后。就可以在Ext中调用controller中的方法了。
第一步 页面上的引入
<script type="text/javascript" src="dispatcher/api-debug.js?groupe=reg"></script>

1. dispatcher/api-debug.js中的dispatcherw为web.xml中配置的映射
groupe=reg 为组 用来区分是哪个action的哪个方法

2. 在js文件中需要引入Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);

3.掉用方法

                //调用了Verify下的verifyName()方法                handler: function() {                    var values = regForm.getForm().getValues();//                    var values = this.up('form').getForm().values();                    verify.verifyName(values, function(value){                        Ext.Msg.alert('response',value);                    });                }


Verify类
package controller;import ch.ralscha.extdirectspring.annotation.ExtDirectMethod;import ch.ralscha.extdirectspring.annotation.ExtDirectMethodType;import org.springframework.stereotype.Service;/** * * @author AAries */@Servicepublic class Verify {    @ExtDirectMethod(value = ExtDirectMethodType.SIMPLE_NAMED, group = "reg")    public String VerifyName(String userName,String password,String eMail){        return String.format("Hi %s, your eMail is %s ", userName, eMail);    }}


显示结果为
[img]
[/img]

读书人网 >Web前端

热点推荐