This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 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: 396
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.

I agree. Here's the link:
subject: Using ActionErrors with Exceptions
It's not a secret anymore!