I am trying to get values from a form to another form on the submit. As i need to pass info from one page to another using post. However I get null for the object.
here is my code:
form 1
<form:form id="user" modelAttribute="user" method="post" action="">
    <form:input type="text" placeholder="" id="name" path="name" maxLength="10" style="width:150px" />
    <form:input type="text" placeholder="" id="address" path="name" maxLength="32" style="width:150px" />
    <form:input type="text" placeholder="" id="phone" path="phone" maxLength="32" style="width:150px" />        
</form:form>
form 2
<form:form  id="selectRuleforuserForm" action="/myApp/selectRule" enctype="multipart/form-data" modelAttribute="rule" method="post">        
    <form:input type="hidden" name="name" id="major_Version" path="name"/>
    <form:input type="hidden" name="address" id="internal_TradeId" path="adress"/>
    <form:input type="hidden" name="phone" id="reporting_Party" path="phone"/>      
    <input type="submit" id="selectRules" class="ui-widget" value="Select Rules"/>
</form:form >
Javascript
$("#selectRuleforuserForm").submit(function(){
                    var user="${user.name}";
                    var add="${user.adress}";
                    var phone="${user.phone}";
                    $("name").val(user);
                    $("address").val(add);
                    $("phone").val(phone);
 });
Controller:
 @RequestMapping(value="/selectRule",method=RequestMethod.POST)
     public String updateRulesForUserRequest(Rule rule,BindingResult result,Model model,HttpServletRequest request,HttpServletResponse response){
        log.info("Select rules for user: "+rule.toString());
     }
logs:
2016-04-20 18:43:06,646 INFO  administrator - Select rules for user: Rule [name=, address=, phone=], org.springframework.validation.BindingResult.Rule=org.springframework.validation.BeanPropertyBindingResult: 0 errors - com.myApp.RuleController:112
 
     
     
    