Customizing spring exception handler AbstractHandlerExceptionResolver error view
Hi <BR> I am building one application using Spring 3.0.<br>And for exception handling i had made use of **AbstractHandlerExceptionResolver** .<br>My Class handles all exceptions and then using ModelAndView I am sending exception class name to view.<br>I have also one properties file having mapping between exception class and error messages.<br>so in view it will set error message for exception class name set in returned modelandview and will be displayed to user. below is the code snippets<br>**My Exception Handler**
    
    public class CentralizedExceptionHander extends
		AbstractHandlerExceptionResolver {
	@Override
	protected ModelAndView doResolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex) {

		ex.printStackTrace();
		ModelAndView exceptionalModel = new ModelAndView("BusinessException");
		exceptionalModel.addObject("EXCEPTION_THROWN", ex.getClass().getName());
		return exceptionalModel;
	}
}<br><br>**My Properties File**<br>
    
org.springframework.security.access.AccessDeniedException =HTTP Status 403 - Access is denied.You do not have permission to this service.<br>**My Controller**

    @RequestMapping(value = "/account/createUser.do", method = RequestMethod.POST)
	public ModelAndView submitCreateUserPage(
	@ModelAttribute("userModel") User user, BindingResult result

	) throws UserAlreadyExistsException {
		....
		// this will throw UserAlreadyExistsException if user with same username already exists in system.
}<br><br>i am using **InternalResourceViewResolver** for handler maping<br> In my View I am displaying error message from getting it from properties file.<br>
Above code working fine..but i want to enhance it..<br>What I want to do , instead of returning control to **my View - BusinessException.jsp** i want to redirect user to last page where he was before exception occurs.<br>i.e<br>if I am at **CreateUser.jsp(mapped from /account/createUser.do)** and exception occurs then instead of redirecting to BusinessException.jsp , i want to redirect t same page i.e createUser.jsp from which request came...<br>please help...
Customizing spring exception handler AbstractHandlerExceptionResolver error view
===

Hi <BR> I am building one application using Spring 3.0.<br>And for exception handling i had made use of **AbstractHandlerExceptionResolver** .<br>My Class handles all exceptions and then using ModelAndView I am sending exception class name to view.<br>I have also one properties file having mapping between exception class and error messages.<br>so in view it will set error message for exception class name set in returned modelandview and will be displayed to user. below is the code snippets<br>**My Exception Handler**
    
    public class CentralizedExceptionHander extends
		AbstractHandlerExceptionResolver {
	@Override
	protected ModelAndView doResolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception ex) {

		ex.printStackTrace();
		ModelAndView exceptionalModel = new ModelAndView("BusinessException");
		exceptionalModel.addObject("EXCEPTION_THROWN", ex.getClass().getName());
		return exceptionalModel;
	}
}<br><br>**My Properties File**<br>
    
org.springframework.security.access.AccessDeniedException =HTTP Status 403 - Access is denied.You do not have permission to this service.<br>**My Controller**

    @RequestMapping(value = "/account/createUser.do", method = RequestMethod.POST)
	public ModelAndView submitCreateUserPage(
	@ModelAttribute("userModel") User user, BindingResult result

	) throws UserAlreadyExistsException {
		....
		// this will throw UserAlreadyExistsException if user with same username already exists in system.
}<br><br>i am using **InternalResourceViewResolver** for handler maping<br> In my View I am displaying error message from getting it from properties file.<br>
Above code working fine..but i want to enhance it..<br>What I want to do , instead of returning control to **my View - BusinessException.jsp** i want to redirect user to last page where he was before exception occurs.<br>i.e<br>if I am at **CreateUser.jsp(mapped from /account/createUser.do)** and exception occurs then instead of redirecting to BusinessException.jsp , i want to redirect t same page i.e createUser.jsp from which request came...<br>please help...