struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Prepare method being invoked twice
Date Thu, 14 Aug 2008 11:26:02 GMT
--- On Thu, 8/14/08, Jayeshpowar wrote:
> Thanks Lukasz for quick reply. But the action class that has
> the prepare method has four methods.

The salient point was that prepare() will be called before any method in the class, regardless
of how many methods the class has.

If you're calling a single method (like during a typical action request) and prepare() is
being called multiple times then something has gone wrong, but without more information (action
configuration, interceptor stack configuration, relevant action code, etc.) it will be difficult
to help.

Dave

> Lukasz Lenart wrote:
> > 
> >> I have an action class which implements preparable
> . It works fine but i
> >> noticed that the prepare method inside the action
> class gets invoked
> >> twice
> >> before getting to the intended method.In first
> invocation the variables
> >> inside the action class are all null , However in
> second invocation they
> >> all
> >> are prefilled from the page.Can anyone explain why
> it gets invoked twice
> >> ?.
> > 
> > If you implemented only prepare() method, it will be
> called each time
> > before any call to action's method of this class.
> If you have methods:
> > input() and update(), prepare() will be called before
> input() and
> > update(). If you want to call it only before input()
> add
> > prepareInput() or prepareDoInput() method [1]
> > 
> > It can be also issue with Ajax TabbedPanel, try to
> search in group
> > archive.
> > 
> > 
> > [1]
> http://struts.apache.org/2.x/docs/prepare-interceptor.html
> > 
> > 
> > Regards
> > -- 
> > Lukasz
> > http://www.lenart.org.pl/
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Prepare-method-being-invoked-twice-tp18978969p18979442.html
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message