---
title: "ExtDirectSpring的用法一"
author: "AAries"
date: "2011-09-26T20:40:00Z"
tags: []
categories: ["Web前端"]
slug: "extdirectspring"
draft: false
lastmod: "2011-09-26T20:40:00Z"
id: 1180956
url: "https://ati000.iteye.com/blog/1180956"
---

环境搭建好以后。就可以在Ext中调用controller中的方法了。 第一步 页面上的引入 1. dispatcher/api-debug.js中的dispatcherw为web.xml中配置的映射 groupe=reg 为组 用来区分是哪个action的哪个方法 2. 在js文件中需要引入Ext.direct.Manager.addProvider(Ext.app.REMOTING\_API); 3.掉用方法 \[code="java"] //调用了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); }); } \[/code] Verify类 \[code="java"] 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); } } \[/code] 显示结果为 \[img] \[/img]