my dog learned polymorphism*
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 Murach's Java Servlets and JSP this week in the Servlets 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