Re: adding an ActionError in the Action
Andrew, Did you ever get an answer? What we found was that we could copy to the request scope and errors work fine. I then tried changing the doRequest for HttpError and it seems OK. David Morris >>> [EMAIL PROTECTED] 04/26/01 02:29AM >>> 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
Re: adding an ActionError in the Action
Have u looked at saveErrors() method of Action object. It should do the work that you wish to do, just remember to use the errors tag in your page --Andrew Steady <[EMAIL PROTECTED]> wrote: > > 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 > > __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: adding an ActionError in the Action
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 > > >