比如说,action中有一个actionForm对象,但是actionForm对象中还有一个user对象,我想把jsp中的form中的信息通过ajax提交直接封装进user之中,怎么写啊?一层会写,两层就不知道了。求教各位大神!!!!!
前台是一个关于用户的信息form
<form></form>
后台:
action中有:
private ActionForm actionForm;
ActionForm这个类中有:
private User user;jQueryAjaxJSP序列化

解决方案 »

  1.   

    部分代码:
    ###################################################
    var result=$("#actionForm.cust").serialize();
    $.ajax({
    type : "post",
    data:result,
    url : "<%=request.getContextPath()%>/resource/assign/resActionVerifyAction!addCust.do",
    success : function(msg) {
    alert(msg);
    },
    error : function(XMLHttpRequest, textStatus, errorThrown) {
    alert(errorThrown);
    }
    });###########################################################
    <form method="post" name="actionForm.cust" id="actionForm.cust">
    <table>
    <tr>
    <td>
    <label>客户编号</label></td><td><input type="text" name="actionForm.cust.custId"></td>
    <td>
    <label>上级客户编号</label></td><td><input type="text" name="actionForm.cust.parentCustId"></td>
    </tr>###############################
    public class ResActionVerifyAction extends Action {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    private String CustName;
    protected ResActionVerifyActionForm actionForm;
    #########################################
    public class ResActionVerifyActionForm extends PageGridActionForm {
    /**
     * 
     */
    private static final long serialVersionUID = 3402939650277627683L;
    private CustMVO custMVO=new CustMVO();
    private CustSVO cust=new CustSVO();
      

  2.   

    用反射, 可以去模拟struts 的自动注入