• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Handling response.redirect errors in JSP page

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 182
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
He baked a muffin that stole my car! And this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic