• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Handling multiple error code through one entry in web.xml

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

Is it possible to handle multiple error codes using only one entry in the web.xml??

I mean for example if I have to handle 404 error code, I will make the following entry in web.xml :-

<error-page>
<error-code>404</error-code>
<location>/pageNotfound</location>
</error-page>

But now I want to handle all the error codes of 500 range like 500, 501, 502.. etc....

Is it possible to write a generalize error code thing and handle all the error codes frrom say 500 - 600, and redirect it to same error page?

Thanks in advance for giving some pointer on this.

Thanks
Priyanka
 
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I were at your place, I would put following entries in web.xml and forget them all.



But thing is I don't know how to produce 500,501 errors to test scenarios.

Do you know how to produce them?
 
Kumari Priyanka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Akhilesh.... but that entry will only take care for error code 500 not the all 500 series error code.
and yeah you can set the error code in response programatically.... response.setStatusCode()
 
Akhilesh Trivedi
Ranch Hand
Posts: 1609
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. See if this works.



Do keep the entry for 404 also.
 
Ranch Hand
Posts: 253
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for server specific exceptions we can keep



for page not found errors we must write


Thanks
Vipul Kumar
 
reply
    Bookmark Topic Watch Topic
  • New Topic