--- Mike Jasnowski <[EMAIL PROTECTED]> wrote:
> >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.

I think it's a larger pain than you think.  Every Action would have to
call removeMessages().  Even worse, what about forwards that don't use a
custom action such as:

<action path="/something" forward="/something.jsp"/>  ?

> 
> 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.

I think you missed an important distinction in my solution.  The tags
don't change at all.  A special subclass of ActionMessages is stored in
the session that only returns its messages one time.  Any subsequent call
to that object returns no messages so none are displayed.  The actual
object stays around in the session until it is overwritten with new
messages or the session expires.

David

> 
> 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]
> 


__________________________________
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]

Reply via email to