Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checked exceptions in struts

 
vinaykrothapalli kumar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
vinay
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi kumar

U can handle this exception also .but its not a good practice to do a that....
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic