Advertisement
Guest User

Untitled

a guest
Jan 7th, 2013
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. Im struggling with showing an error that isn't related to a bind attribute:
  2.  
  3. Controller:
  4. @RequestMapping(value = "/module/appointment/appointmentList", method = RequestMethod.POST)
  5. public void onSubmit(HttpServletRequest request, @ModelAttribute("appointmentList") List<Appointment> appointmentList,
  6. Errors errors, @RequestParam(value = "selectAppointment", required = false) Appointment selectedAppointment,
  7. ModelMap model, @RequestParam(value = "fromDate", required = false) Date fromDate,
  8. @RequestParam(value = "toDate", required = false) Date toDate) {
  9. if (fromDate != null && toDate != null && !fromDate.before(toDate)) {
  10. errors.reject("appointment.Appointment.error.InvalidDateInterval");
  11. model.put("errors", errors);
  12. return;
  13. }
  14. ....
  15. }
  16.  
  17.  
  18. JSP:
  19. <form:form method="post" modelAttribute="selectedAppointment" id="manageAppointmentsForm">
  20. <form:errors cssClass="error" element="div"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement