@RequestMapping(value = "/user-edit-form", method = RequestMethod.POST)
public String userEditForm(@ModelAttribute("userEditCommand") UserEntity userEntity, BindingResult result, ModelAndView model, @RequestParam("userPhotoPath") MultipartFile file, HttpServletRequest request) throws IOException {
((Model) model).addAttribute("user", new UserEntity());
return "staff-user-profile";
//return new ModelAndView("staff-user-profile","user",userEntity);
}
人员-用户profile.jsp
<form:form class="form-horizontal" action="staff-edit-form" commandName="userEditCommand" enctype="multipart/form-data" modelAttribute="userEditCommand">
<form:label path="userFirstName" >First name:</form:label>
<form:input path="userFirstName" value="${user.userFirstName }"/>
<form:label path="userLastName" >Last name:</form:label>
<form:input path="userLastName" value="${user.userLastName }"/>
<form:label path="userAddress" >Address:</form:label>
<form:textarea path="userAddress" cols="5" rows="3" value="${user.userAddress }"></form:textarea>
<form:label path="userCity" >City:</form:label>
<form:input path="userCity" value="${user.userCity }" />
<form:label path="userCountryId" >Country:</form:label>
<form:select path="userCountryId" >
<form:options items="${countryList}" />
</form:select>