Results 1 to 1 of 1

Thread: Forward invalid url to error page

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    Default Forward invalid url to error page

    Hi, I'm new to Spring Surf and tryng to figure out a way to forward any invalid requests to an error page that uses a template. I would prefer to use a template rather than a generic error.jsp file.

    So, if a user was to enter a invalid url for a page that doesn't exist i.e. http://myapplication/dafasfirkdariE then forward that request to the template http://myapplication/error.

    I have tried mapping it in the web.xml, i.e.

    Code:
    <error-page>
    	  <exception-type>javax.servlet.ServletException</exception-type>
    	  <location>/error/error.xml</location>
      	</error-page>
    Of course that didn't work, then I found out about Spring's SimpleMappingExceptionResolver, this seemed like a better solution, but didn't work either. When I entered an invalid URL and debugged the DispachSevlet class the ServletException is being thrown in the render method and the processHandlerException method is not called, for SimpleMappingExceptionResolver to handle the ServletException it must be thrown in doDespatch method then the processHandlerException method will be called.

    I thought the SimpleMappingExceptionResolver would be the answer to this problem but it doesn't seem so, does anyone know how this can be done?

    Thanks in advance.
    Last edited by dan2009; Jan 13th, 2011 at 06:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •