IT Community - Software Programming, Web Development and Technical Support

How does JSP handle run-time exceptions?

This is a discussion on How does JSP handle run-time exceptions? within the Java Server Pages (JSP) forums, part of the Web Development category; .........................


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Java Server Pages (JSP)

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-27-2007, 04:53 AM
leoraja8 leoraja8 is offline
D-Web Sr.Programmer
 
Join Date: May 2007
Posts: 194
leoraja8 is on a distinguished road
Question How does JSP handle run-time exceptions?

......................
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-10-2007, 04:03 AM
amansundar amansundar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 320
amansundar is on a distinguished road
Default Re: How does JSP handle run-time exceptions?

You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example:

<%@ page errorPage="error.jsp" %>

redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing.

Within error.jsp, if you indicate that it is an error-processing page, via the directive:


<%@ page isErrorPage="true" %>

the Throwable object describing the exception may be accessed within the error page via the exception implicit object.

Note: You must always use a relative URL as the value for the errorPage attribute.
__________________
cheers
Aman
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-10-2007, 04:09 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 206
krishnakumar is on a distinguished road
Default Re: How does JSP handle run-time exceptions?

Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting of a JSP.
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-20-2008, 08:39 PM
saravanan saravanan is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Posts: 181
saravanan is on a distinguished road
Default Re: How does JSP handle run-time exceptions?

1.Create a jsp page called error.jsp in your web root.
2.Add this command in your all JSP page. <%@ page isErrorPage="true" %>
3.Specify the error page path like <%@ page errorPage="error.jsp" %>

Then, if your page encounter a runtime error you will be redirect to the error page.

Just add content on error page depending the type of the error
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can we Handle Exception in VB.Net? anbuchezhians VB.NET Programming 2 09-10-2007 04:19 AM
Exceptions using recovery scenario manager Shanthi Testing Tools 1 08-25-2007 01:36 AM
object exceptions simplesabita Testing Tools 1 08-22-2007 02:48 AM
classes of exceptions may be thrown by a throw statement anbuchezhians Java Programming 1 08-01-2007 10:58 PM
Diff between Transaction-time and Server response-time vadivelanvaidyanathan Software Testing 0 03-21-2007 06:29 AM


All times are GMT -7. The time now is 02:26 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0