wood burning stoves 2.0
The moose likes Struts and the fly likes Checked exceptions in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Checked exceptions in struts" Watch "Checked exceptions in struts" New topic

Checked exceptions in struts

vinaykrothapalli kumar

Joined: Aug 29, 2005
Posts: 12
Hi friends
i am new to struts and i have a small doubt
how can we handle the checked exceptions( ex:-- NumberFormat Exception) in struts
please help me
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi kumar

U can handle this exception also .but its not a good practice to do a that....
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

Originally posted by sreenath reddy:
Hi kumar

U can handle this exception also .but its not a good practice to do a that....

I completely disagree about this being a bad practice in general. You should catch and handle any Exception for which you want to display a specific and meaningful error message to the user.

A good workman is known by his tools.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
i am with marc. handling exceptions is a MUST!

struts has built-in mechanisms (via struts-config.xml mappings) to map exceptions globally or locally (to each action) and forward to a JSP, action, or tiles definition when an exception is thrown. you can also define exception handler for each exception (see http://struts.apache.org/userGuide/building_controller.html#exception_handler ... use the 'path' attribute instead of 'handler' attribute if you want to forward to JSP/action/tiles def).

-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: Checked exceptions in struts
It's not a secret anymore!