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?
Asked
Active
Viewed 334 times
0

Roman C
- 49,761
- 33
- 66
- 176

Swagato Dey
- 33
- 5
-
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 Answers
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
-
This code helped me in what I wantd to do. Just I didnt use the xception type to make it general.
/404.jsp