Here's my scenario. Our site has a page that shows all off the service contracts you currently have with the company. If you don't have any contracts, we'd like to display a different page that tells you how great the service contracts are and how you should buy one.
Currently, I'm just doing an if statement in showForm. Something along the lines of
But it seems strange (yucky even) to be getting the command object via the BindException. Is there a better way?Code:protected ModelAndView showForm(HttpServletRequest request, HttpServletResponse response, BindException errors) throws Exception { ContractList contractList = (ContractList) errors.getModel().get(getCommandName()); if (contractList.getContracts() == null) { return new ModelAndView("buyContracts"); } return super.showForm(request, response, errors); }


Reply With Quote