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
error.
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 ....
this.addActionError(e.getMessage());
Or don't catch this specific exception anywhere in actions and use
global exception handling instead [1].
Regards,
Yasser.
[1] https://struts.apache.org/getting-started/exception-handling.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]