>I would expect the same way an Action determines that it needs to call
>saveErrors(), if there are errors in the collection. The Action makes the
>determination on whether errors exist and need to be passed to a JSP or
>another action. The next action that is invoked may or may not care about
>these errors, and calls removeXXX(). That is a bit of a pain I would agree
>to have to explicitly make a call to removeErrors() you don't care about.

Let me clarify this a bit more. I think when the application is being
designed, the appdev knows which actions could forward to a particular
action, as well as general application flow. The appdev decides that no
matter who its caller or forwarding entity was, that it's going to disregard
any messages/errors.

The appdev also knows that some actions can only be forwarded to by a small
set or single action, in which case and wants to carry those messages
forward until some future time. In the cases of actions that can be
forwarded to by many other entities, but only wants to remove
messages/errors for some of those would be a bit problematic.  But I think
distinct actions which implement a use-case know when they do or do not care
about errors that happened in a previous action, thus the application
dictates when to remove messages/errors.

Mike Jasnowski

-----Original Message-----
From: Mike Jasnowski [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:45 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: ExceptionHandler storing ActionErrors in session


>How would your Action know to call that?  How would your app know which
>Action was executed after the one that generated the messages?

I would expect the same way an Action determines that it needs to call
saveErrors(), if there are errors in the collection. The Action makes the
determination on whether errors exist and need to be passed to a JSP or
another action. The next action that is invoked may or may not care about
these errors, and calls removeXXX(). That is a bit of a pain I would agree
to have to explicitly make a call to removeErrors() you don't care about.

But how does the tag know whether it should clear them out after one use?
At least with the action the user then has more precise control over "when"
the messages are cleared.

That said, there may not be many, if any, cases of having to carry messages
past one use. But for example in an application where you have recorded some
errors/messages, but allow the user to continue on. And the messages are
shown persistently at the top of a page or in some other frame, Once the
user decides to "clear" the errors/messages, an Action would then call the
removeXXX() method.

Mike Jasnowski

-----Original Message-----
From: David Graham [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 03, 2003 5:34 PM
To: Struts Users Mailing List
Subject: RE: ExceptionHandler storing ActionErrors in session


--- Mike Jasnowski <[EMAIL PROTECTED]> wrote:
> What about adding a symmetrical removeErrors()/removeMessages() to
> Action?

How would your Action know to call that?  How would your app know which
Action was executed after the one that generated the messages?

David

>
> -----Original Message-----
> From: David Graham [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 03, 2003 5:21 PM
> To: Struts Users Mailing List
> Subject: Re: ExceptionHandler storing ActionErrors in session
>
>
> I don't believe there is currently a way to remove messages from the
> session.  How would Struts know when to remove them?  I have written a
> small subclass of ActionMessages that only returns its messages once.
> This allows me to store messages in the session without them being
> displayed multiple times.
>
> You're not the first person to need this feature so maybe it's time to
> float the subclass idea on struts-dev (unless there is a better way).
>
> David
>
>
> --- Robert Taylor <[EMAIL PROTECTED]> wrote:
> > I'm just starting to fiddle around with ExceptionHandlers and was
> > wondering
> > how and when ActionErrors are removed from session scoped if
> configured
> > to
> > be "stored" there.
> >
> > I took a look at the ErrorsTag and the MessagesTag (because I'm
> assuming
> > these tags would be used to render the ActionErrors) and didn't see
> > provisions for removing ActionErrors from session scope.
> >
> > I must have missed something obvious here and would appreciate anyone
> > who
> > could point me in the right direction.
> >
> > robert
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to