日期:2014-05-16  浏览次数:20341 次

SSH+ExtJS框架中Action往Extjs传参
我在Action中定义了一个字符串
private String example;
set get方法省略
public String decision(){
this.example = "example";
return SUCCESS;
}
struts.xml中的配置
<action name="feeding_*" class="feedingRatesAction" method="{1}">
<result type="json" />
</action>
JS:
decisionForm.form.submit({
        url : 'feeding_decision.action',
        success : function(from, action) {
         Ext.Msg.alert('', '提交成功!');
                  Ext.Msg.alert('', '提交成功!');//在这个位置显示example的值
        },
        failure : function(form, action) {
         Ext.Msg.alert('', '提交失败!');
        },
        waitMsg : '正在提交数据,稍后...'
       });


我在页面中的Ext.Msg.alert()中想取到Action中的example的值:
success : function(form, action) {
    Ext.Msg.alert('value', action.result.example);
}