Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling response.redirect errors in JSP page

 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
sreenivas jeenor
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic