Hi,
I'm using Spring 3.0. I have this JSP page (/account/edit-profile) ...
and I submit the form to this controller-method:Code:<form:form action="/account/edit-profile" commandName="form" method="post"> <p><font color="red"> <form:errors path="*"/> </font></p> <div class="field-container double"> <div> <span class="blue">*</span><form:label path="firstName" for="first-name">First Name</form:label><br /> <form:input path="firstName" cssClass="string keyword" id="first-name" maxlength="50" /> </div> ...
Code:@RequestMapping(method = RequestMethod.POST) public String onSubmit(HttpServletRequest request, Model model, @ModelAttribute("registrationForm") RegistrationForm form, BindingResult result) { String viewName = "/account/edit-profile"; model.addAttribute("form", form); User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); if (!user.getEmail().equals(form.getEmail()) && userDaoImpl.getUser(new User(form.getEmail(), "")) != null) { // Reverting back to the old email. ... } else { registrationValidation.validate(form, result); log.debug("has errors:" + result.hasErrors()); ... return viewName; }
Even though the "result.hasErrors()" call is returning true in the debug statement, nothing is getting printed out when I am returned back to my view for editing. Any ideas why? - Dave


Reply With Quote