File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Using ActionErrors with Exceptions" Watch "Using ActionErrors with Exceptions" New topic

Using ActionErrors with Exceptions

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 397
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.

subject: Using ActionErrors with Exceptions
It's not a secret anymore!