aspose file tools*
The moose likes JSP and the fly likes Handling response.redirect errors in JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Handling response.redirect errors in JSP page" Watch "Handling response.redirect errors in JSP page" New topic
Author

Handling response.redirect errors in JSP page

sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
Hi

i have a condition where an URL is manipulated or changed wantedly. i have to catch the error and move to error page. but the error page is never called.

I am using response.sendRedirect("MyURL"); in the jsp page. If the URL is correct its working fine.

If i manipulate the URL and use the command it shows HTTP 404 error in the same page but not calling the error page

here is my code.help me out
Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

i have a condition where an URL is manipulated or changed wantedly. i have to catch the error and move to error page. but the error page is never called.

I am using response.sendRedirect("MyURL"); in the jsp page. If the URL is correct its working fine.

If i manipulate the URL and use the command it shows HTTP 404 error in the same page but not calling the error page

Are you trying to show a common "Page does not exist" error page?
If yes then you have to configure it in web xml file
Like


A.A.Anbarasu
sreenivas jeenor
Ranch Hand

Joined: Jan 09, 2005
Posts: 125
hi anbarasu,

here i dont want an common exception page.

what i want is when response.redirect() is failed due to error then the exceptionHandler.jsp should be called.

but this is not happening.instead of opening exceptionHandler.jsp it shows HTTP 404

Anbarasu Aladiyan
Ranch Hand

Joined: Jun 02, 2009
Posts: 182

hi sreenivas rap,
what i want is when response.redirect() is failed due to error then the exceptionHandler.jsp should be called

When the above case occurs it causes http 404 error. By default when the 404 error occurs, server shows the default 404 error page.
We can use the custom page for displaying http 404 by defining it in web xml.
In your case you can call the "exceptionHandler.jsp" page when 404 error occurs.
 
wood burning stoves
 
subject: Handling response.redirect errors in JSP page