Getting back the object from JSP
I can send an object via model from a controller to a jsp page, but how to
get that object back to the controller, after saving some data to it?
My form looks like this:
<form:form method="POST" modelAttribute="user"
action="/GENEPI/userChangePassword" commandName="user">
<spring:message code="label.newPassword" />
<br>
<input id="password" type="password"
pattern=".{8,30}" class="input-block-level"
onFocusOut="passwordValidation();"
title="ERROR" />
</form:form>
And my controller like this:
@RequestMapping(value = "/userChangePassword", method = RequestMethod.POST)
public String changePasswordPOST(@ModelAttribute("user") UserEntity user,
@ModelAttribute("newPassword") String newPassword, Model model) {
System.out.println("USERNAME: " + user.getUsername());
}
Nevertheless user is always null. How to make it to pass that user object
from jsp to controller with the data user has filled there?
No comments:
Post a Comment