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

Error handling in JSp's

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi all,
How can we throw an exception from an erroneous JSP to error page.
Am using the page directive <%@ page errorPage="errorpage.jsp" %>
in each page.
But I don't know how to throw an exception in case any exception is raised.
For ex:
<%
String s[] = getNamesFromList();
%>
Say this raises an exception then how do i catch the same and throw it .
Your suggestions are welcome.
Regards,
Mahesh

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From whatever minimal knowledge I have about JSPs, I will try to answer this. You don't need to catch and throw the exceptions from your first page. If and when an exception occurs, it is automagically passed to the error page and you can do whatever you want with the exception(ex:do a printStackTrace()) in the error page. Hope this Helps!
 
Mahesh Eshwarappa
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for u r reply.
I was so dumb trying to figure out how to throw exception.
Mahesh
 
Do Re Mi Fa So La Tiny Ad
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic