Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to catch errors inJSP  RSS feed

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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
  • 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}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!