• 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

How to catch errors inJSP

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am catching error page by isError page but could not do properly can u guide me any one...


thanks advance

cheers
amit bhadre
 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Three ways to catch errors:

To redirect to an error page:
1. declare one jsp as being the error page:
<%@ page isErrorPage="true" %>
2. declare the error-risky page as having an error page :
<%@ page errorPage="error.jsp" %>
Where error.jsp is the name of the first jsp (in 1.)

Yet another way to redirect, but works for the whole web app:
Declare in DD the exception-type to catch or the error code to catch and associate to a page:
<error-page>
<exception-type> fully qualified excpetion class </exception-type>
<location>/error.jsp</location>
</error-page>

And finally, the c:catch JSTL tag :

<c:catch var="errVar">
risky code
<c:catch>

var is optional. If defined, it may be used AFTER the catch block to get error message like this :
${errVar.message}
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic