Announcement Announcement Module
Collapse
No announcement yet.
Forward invalid url to error page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 07:09 PM.
Working...
X