`
AAries
  • 浏览: 39001 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

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
 */
@Service
public 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]
  • 大小: 3.3 KB
1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics