| Author |
Exception Handling
|
shilpi_s
Greenhorn
Joined: Jan 04, 2004
Posts: 2
|
|
|
Can anyone tell me how to do exception handling in struts. ?For example if a field already exists in database...the user should get a msg as "data already exists".
|
 |
Ray Stojonic
Ranch Hand
Joined: Aug 08, 2003
Posts: 326
|
|
I do something along the following: error occurs create ActionErrors object create ActionMessage with error text add ActionMessage to ActionErrors object add ActionErrors to request return to page request originated from pick up ActionErrors object with <logic:messagesPresent> tag in jsp display error to user
|
 |
Rick Hightower
Author
Ranch Hand
Joined: Feb 20, 2002
Posts: 350
|
|
You could also do declarative exception handling in the struts config file.
|
Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
|
 |
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
|
|
"shilpi_s", Please take a moment for reading our naming policy. As it stands, your display name fails to comply with the policy so I'll have to ask you to change it accordingly. More specifically, the policy allows the use of initials only for the first name, not the last name. You should also use a space instead of the underscore character. Thanks. And welcome to the JavaRanch!
|
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
|
 |
 |
|
|
subject: Exception Handling
|
|
|