1、action中配置了
Paper paper;及其 get/set2、EXTJS代码:
//ajax提交开始
 Ext.lib.Ajax.defaultPostHeader +=";charset=utf-8";
//提交到服务器操作Action方法
                     addPaperForm.form.doAction('submit',{
                        url:'<%=basePath%>login/paper_add.action', //Action路径 
                         method:'post', //提交方法post或get
                         param:'', 
                         //提交成功的回调函数
                            success:function(form,action){
                              //alert(form.findField("paper.title").getValue());
                              //alert(form.findField("paper.abstra").getValue());
                              Ext.Msg.alert("提交成功!","您的论文已经正确提交!");
                              _window.hide();
                            },
                            //提交失败的回调函数 
                            failure:function(form,action){
                            if(action.failureType=="connect"){ 
                                Ext.Msg.alert('错误','服务器出现错误请稍后再试!'); 
                               }
                            }
});
//ajax提交结束3、form表单:
var addPaperForm = new Ext.FormPanel({
width:500,
height:300,
defaultType:"textfield",
labelWidth:60,
baseCls:"x-plain",
style:"padding:15px",
items:[
{
id:"paper.title",
name:"paper.title",
fieldLabel:"论文标题",
allowBlank:false,
width:400
},
{
id:"paper.abstra",
name:"paper.abstra",
xtype:"textarea",
fieldLabel:"论文摘要",
allowBlank:false,
width:400,
height:150
},
{
id:"paper.other",
name:"paper.other",
xtype:"textarea",
fieldLabel:"参考文献",
width:400,
height:80
}
]
});
问题:
每次提交只能在action接收到paper.title属性!其他两个怎么也接收不到。
但是我在success里执行alert(form.findField("paper.abstra").getValue())却能得到后台没取到的值。
-----
我的struts.xml:
<!-- 后台操作 -->
    <package name="login" extends="struts-default" namespace="/login" >
      <!-- 论文 -->
<action name="paper_*" class="paperAction" method="{1}">
<result name="getManage">/login/manage.jsp</result>
</action>
...万分感谢!

解决方案 »

  1.   

    Paper是一个普通javabean类,包含title,abstra,other字段
      

  2.   

    <!-- 后台操作 -->
      <package name="login" extends="struts-default" namespace="/login" >
      <!-- 论文 -->
    <action name="paper_*" class="paperAction" method="{1}">
    <result type="json" />
    </action>
      

  3.   

    <!-- 后台操作 -->
      <package name="login" extends="json-default" namespace="/login" >
      <!-- 论文 -->
    <action name="paper_*" class="paperAction" method="{1}">
    <result type="json" />
    </action>