• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF : redirect errors to error page

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,

I am trying ( using jsf ) to redirect the errors to the error page errors.jsp , but the following does not work ( part of web.xml)




because when i am trying to access a page which does not exist in my application it display the page with code
HTTP Status 404


is my there anything wrong in my above code , what is the best way to redirect jsf errors to error pages with example if possible.
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All ,

I have changed the code as the following





error.jsp





by the way the above code redirect to error.jsp if there is error but the contents of error.jsp will not be displayed properly i mean only blank page will be displayed ..........
any one can help me to display the content of error.jsp properly.........................

 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any reply
 
Ranch Hand
Posts: 90
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 Suresh

Try with this example

This is the web.xml



The errorDisplay.xhtml



And the Managed Bean "error"


I hope this example will serve to show the error information that you need.

Regards

Cesar

 
Cesar Loachamin
Ranch Hand
Posts: 90
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 Suresh

I forgot to tell you, when you use the this mechanism to show error page you have several objects that contains important information, that objects are placed in the request map.


KeyValueType
javax.servlet.error.status_codeThe HTTP error codeInteger
javax.servlet.error.messageA description of the errorString
javax.servlet.error.exception_typeThe class of the exceptionClass
javax.servlet.error.exceptionThe exception objectThrowable
javax.servlet.error.request_uriThe path to the application resource that encountered the errorString
javax.servlet.error.servlet_nameThe name of the servlet that encountered the errorString


For example if you need to get the page that produce the exception you can do it,


Regards

Cesar
 
Suresh Khant
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Cesar for you reply ,

I have implemented your above code but I have got new error


when redirecting to exception.jsf





Any suggestion
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic