• 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

Can't a page throw more that one exception?

 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

My doubt runs around:
Can't a page tell a container more that one errorPage using?
I tried that like:
<%@page errorPage ="ErrorPage1"%>
<%@page errorPage ="ErrorPage2"%>

But I got compiler error saying I can't have more that one page directive
for errorPage attribute with different values.

I wanted like, forward to the page corresponding to error type, decided later on.

One related doubt: I tried to achieve the same by declaring <error-page>
in the Deployment Descriptor, but until I do tell the container using
<%@page errorPage ="errorPage.jsp"%>, it doesn't work. Is that correct?

Can't container find out that from the DD, which error page to forward
in case exception occurs.

Thanks in advance for clarifying my doubts.

Thanks,
 
Ranch Hand
Posts: 893
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container could find it out if you configure your DD so.

Your could do in the DD

<error-page>
<exception-type> </exception-type>
<location></location>

</error-page>

Where the exception-type is the type of error you want to catch and the location is the location of your error page.

I hope this helps,
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you are right. You have to tell the jsp which is the error page that will do the processing when you encounter any errors in that jsp page.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic