This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Using ActionErrors with Exceptions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using ActionErrors with Exceptions" Watch "Using ActionErrors with Exceptions" New topic
Author

Using ActionErrors with Exceptions

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
Hi,
I am not sure how to populate the struts ActionError list with messages from Exceptions. When I run this, I get a blank message output.

catch (Exception e){
String _err = e.getMessage();
if(_err == null || _err.compareTo("")== StopConstants.STRINGSEQUAL){
_err = StopConstants.UNKNOWNERROR;
}

ActionErrors errors = new ActionErrors();
ActionError am = new ActionError(_err);
errors.add(errors.GLOBAL_ERROR, am);
saveErrors(request, errors);


}
Mallika R Kumar
Ranch Hand

Joined: Jan 21, 2004
Posts: 38
Think ActionErrors will be deprecated - and ActionMessages are to be used for displaying errors. Just FYI.

Mallika.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using ActionErrors with Exceptions
 
Similar Threads
ValidatorForm exception in struts framework
ActionError problem in Struts 2.0
Error with validation
ActionError error
Using more than 1 properties file with Action Form