0

I want the user of my website to land in 404.jsp if some link appears to be broken. For example, I have an index.jsp where there are several links. Now If any link is not found, then the server should redirect to the 404.jsp I don't think <meta http-equiv="refresh" content="1; url=/next/page/to/go/to.jsp"> can be used in this context. How shall I perform this task?

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • If it's only internal links to the web site, this is something that can usually be configured on your server. If it's to external web sites, I don't think you can do much other than testing the link at the server side and dynamically redirecting. In any event, this is more a question for http://serverfault.com/ – Ted Hopp Apr 19 '15 at 07:43

1 Answers1

1

There is a parameter for that in your application's web.xml config file :

<error-page>
   <exception-type>404</exception-type>
   <location>/404.jsp</location>
</error-page>

If the user requests any resource that does not exist, she will be redirected to the given error page.

Olivier Croisier
  • 6,139
  • 25
  • 34