There is a method in the Action class you can use to do this: 
saveErrors(HttpServletRequest request, ActionErrors
errors).
You can also do directly :

request.setAttribute("org.apache.struts.action.ERROR", errors)

So all you have to do is create an ActionErrors object, put errors in it, save it in 
the request and return (new
ActionForward(mapping.getInput())) to return to the form.

This is illustrated in the example application.

Jean-Noel

----- Original Message -----
From: Andrew Steady <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 26, 2001 10:29 AM
Subject: adding an ActionError in the Action


>
> Hi,
>
>
>
> If I form validates itself OK but subsequently the Action needs to raise an
>       input error to the user, in my case security failed, how is it
>       possible to add an ActionError for the errors tag to pick up. The
>       only way to give struts a collection of ActionErrors is by returing
>       it from the ActionForm.validate() method.
>
>
>
> I presume if I know the name of the ActionErrors bean which the error tag
>       accesses I could manually create it in the Action and add it to the
>       correct scope so that the errors tag could pick it up.
>
>
>
> Has anybody encountered this problem before?
>
>
>
> Cheers,
>
>
>
> Andy S
>
>
>

Reply via email to