File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling multiple error code through one entry in web.xml

 
Kumari Priyanka
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Akhilesh Trivedi
Ranch Hand
Posts: 1599
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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: 1599
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. See if this works.



Do keep the entry for 404 also.
 
vipul bondugula
Ranch Hand
Posts: 219
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for server specific exceptions we can keep



for page not found errors we must write


Thanks
Vipul Kumar
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic