struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <>
Subject Re: Struts2.x ActionError And ActionMessage
Date Fri, 17 Nov 2017 06:48:37 GMT

On 11/17/2017 9:12 AM, Yasser Zamani wrote:
> Hello Dhulipudi, Welcome!
> Could you try below please....
> ActionSupport myCurrentActionSupport = (ActionSupport) 
> ActionContext.getContext().getValueStack().peek();
> myCurrentActionSupport.addActionError("my error");

Please remember if it even works, it's not a good design. I just try to 
know if you have an action context there where you're trying to add an 

A better design maybe is to throw a specific exception if you're in 
lower layers than the action and action is not available there (e.g. 
you're in service layer) then simply catch that in your action and then ....


Or don't catch this specific exception anywhere in actions and use 
global exception handling instead [1].



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message