Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Im struggling with showing an error that isn't related to a bind attribute:
- Controller:
- @RequestMapping(value = "/module/appointment/appointmentList", method = RequestMethod.POST)
- public void onSubmit(HttpServletRequest request, @ModelAttribute("appointmentList") List<Appointment> appointmentList,
- Errors errors, @RequestParam(value = "selectAppointment", required = false) Appointment selectedAppointment,
- ModelMap model, @RequestParam(value = "fromDate", required = false) Date fromDate,
- @RequestParam(value = "toDate", required = false) Date toDate) {
- if (fromDate != null && toDate != null && !fromDate.before(toDate)) {
- errors.reject("appointment.Appointment.error.InvalidDateInterval");
- model.put("errors", errors);
- return;
- }
- ....
- }
- JSP:
- <form:form method="post" modelAttribute="selectedAppointment" id="manageAppointmentsForm">
- <form:errors cssClass="error" element="div"/>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement