dcsimg
Exceptions management / errorPage.jsp example
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   HELIGON_Sandra
Posted On:   Tuesday, October 1, 2002 01:50 AM

I defined a class MyServletContextListener where I use exceptions for example: public void contextInitialized(ServletContextEvent arg0) { s_context = arg0.getServletContext(); try { ... } catch (ExInvalidUserName ex) { ?? } catch (ExInvalidPassword ex) { ?? } catch (ExInvalidSessionId ex) { ?? } } In the web.xml I defined the following elements: org.omg.CORBA.UserException.ExInvalidUserName /errorPage.jsp org.omg.CORBA.UserException.ExInvalidPassword /errorPage.jsp org.omg.CORBA.UserException.ExInvalidSessionId /e   More>>

I defined a class MyServletContextListener where I use exceptions for example:

public void contextInitialized(ServletContextEvent arg0)
{
s_context = arg0.getServletContext();
try
{
...
}
catch (ExInvalidUserName ex)
{
??
}
catch (ExInvalidPassword ex)
{
??
}
catch (ExInvalidSessionId ex)
{
??
}
}

In the web.xml I defined the following elements:


org.omg.CORBA.UserException.ExInvalidUserName
/errorPage.jsp


org.omg.CORBA.UserException.ExInvalidPassword
/errorPage.jsp


org.omg.CORBA.UserException.ExInvalidSessionId
/errorPage.jsp


The error message displayed in the errorPage.jsp file depends on the exception.
How does it works ? Where do I specify the error message associated to each specific exception ?
in the following lines ?

catch (ExInvalidUserName ex)
{
// Specify the error message to display ???
}

Has someone an exxample of a JSP page that allows to display exception error ?

Thanks a lot for you help,

   <<Less

Re: Exceptions management / errorPage.jsp example

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, October 1, 2002 06:35 AM

Our error.jsp automatically has a local variable "exception" of type java.lang.Exception, with the value being the exception that caused this error jsp to be invoked (i.e. we just do exception.getMessage, exception.printStackTrace etc.), presumably because of the page directive "isError='true' ".

Re: Exceptions management / errorPage.jsp example

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, October 1, 2002 06:34 AM

Our error.jsp automatically has a local variable "exception" of type java.lang.Exception, with the value being the exception that caused this error jsp to be invoked (i.e. we just do exception.getMessage, exception.printStackTrace etc.), presumably because at the top of the page we said "<%page isError='true' %>".

Re: Exceptions management / errorPage.jsp example

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, October 1, 2002 06:33 AM

Our error.jsp automatically has a local variable "exception" of type java.lang.Exception, with the value being the exception that caused this error jsp to be invoked (i.e. we just do exception.getMessage, exception.printStackTrace etc.), presumably because at the top of the page we said "<%page isError='true' %>".

Re: Exceptions management / errorPage.jsp example

Posted By:   Christopher_Koenigsberg  
Posted On:   Tuesday, October 1, 2002 06:33 AM

Our error.jsp automatically has a local variable "exception" of type java.lang.Exception, with the value being the exception that caused this error jsp to be invoked (i.e. we just do exception.getMessage, exception.printStackTrace etc.), presumably because at the top of the page we said "<%page isError='true' %>".

About | Sitemap | Contact