You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by st...@gmail.com on 2007/06/25 02:18:50 UTC

Parameter interception

If I call an action with an id=20 parameter and that action contains both a
field called id and a bean that contains an id field, both fields are being
set to 20.  Does the parameter "setter" logic set everything on the action
object hierarchy that it can find with the same name?

-- 
Scott
stanlick@gmail.com

Re: Parameter interception

Posted by Dave Newton <ne...@yahoo.com>.
--- stanlick@gmail.com wrote:
> Hey Dave, to you care to comment?

Sure; might as well earn my pay today.

Oh, wait.

>> Do you know what the code would look like to get
the
>> id off the action?

AFAIK ModelDriven just pushes the model on to the top
of the stack, so the easiest would be to use the OGNL
stack notation: "[1].id"

d.



       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/

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


Re: Parameter interception

Posted by st...@gmail.com.
Hey Dave, to you care to comment?

On 6/25/07, stanlick@gmail.com <st...@gmail.com> wrote:
>
> Alright!  Now we are getting somewhere.  Do you know what the code would
> look like to get the id off the action?
>
> Scott
>
> On 6/25/07, Dave Newton < newton.dave@yahoo.com> wrote:
> >
> > --- stanlick@gmail.com wrote:
> > > <s:property value="payrollUpdate.id"/>
> > > <s:property value="id" /><br>
> >
> > If you've implemented ModelDriven and it's returning
> > the payrollUpdate, then this would be expected
> > behavior: ModelDriven puts the model on the stack so
> > its properties are available w/o prefixing.
> >
> > d.
> >
> >
> >
> >
> > ____________________________________________________________________________________
> >
> > Take the Internet to Go: Yahoo!Go puts the Internet in your pocket:
> > mail, news, photos & more.
> > http://mobile.yahoo.com/go?refer=1GNXIC
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>
> --
> Scott
> stanlick@gmail.com




-- 
Scott
stanlick@gmail.com

Re: Parameter interception

Posted by st...@gmail.com.
Alright!  Now we are getting somewhere.  Do you know what the code would
look like to get the id off the action?

Scott

On 6/25/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- stanlick@gmail.com wrote:
> > <s:property value="payrollUpdate.id"/>
> > <s:property value="id" /><br>
>
> If you've implemented ModelDriven and it's returning
> the payrollUpdate, then this would be expected
> behavior: ModelDriven puts the model on the stack so
> its properties are available w/o prefixing.
>
> d.
>
>
>
>
>
> ____________________________________________________________________________________
> Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail,
> news, photos & more.
> http://mobile.yahoo.com/go?refer=1GNXIC
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Scott
stanlick@gmail.com

Re: Parameter interception

Posted by Dave Newton <ne...@yahoo.com>.
--- stanlick@gmail.com wrote:
> <s:property value="payrollUpdate.id"/>
> <s:property value="id" /><br>

If you've implemented ModelDriven and it's returning
the payrollUpdate, then this would be expected
behavior: ModelDriven puts the model on the stack so
its properties are available w/o prefixing.

d.



       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC

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


Re: Parameter interception

Posted by st...@gmail.com.
I have a PayrollAction class that extends BaseAction which has an id field.
PayrollAction also contains a bean that contains an id field.  The id fields
are the Hibernate PKs.  My BaseAction
extends ActionSupport implements SessionAware, ModelDriven, Preparable.  I
have carefully observed the following behavior.  When a request is made of
PayrollAction with a parameter id=20, the following jsp displays 20 for both
fields:

            payrollUpdate.id: <s:property value="payrollUpdate.id" /><br>
            id: <s:property value="id" /><br>

If I set a breakpoint and change the id in the bean inside PayrollAction,
both fields display the updated value!  It is as though id and
payrollUpdate.id are the same!  My PayrollAction class has a
getPayrollUpdate() method that returns the PayrollUpdate bean.  This seems
very strange.






On 6/24/07, Dave Newton <ne...@yahoo.com> wrote:
>
> --- stanlick@gmail.com wrote:
> > If I call an action with an id=20 parameter and that
> > action contains both a field called id and a bean
> > that contains an id field, both fields are being set
>
> > to 20. Does the parameter "setter" logic set
> > everything on the action object hierarchy that it
> can
> > find with the same name?
>
> I don't think so; that could take an indeterminate
> amount of time.
>
> I just wrote an Action with a Long id field and an
> object that has a Long id field; if I pass in an id=5
> just the Action's id field gets set. If I implement
> ModelDriven then just the object's id field is set.
>
> Are you using the default stack?
>
> d.
>
>
>
>
>
> ____________________________________________________________________________________
> Get your own web address.
> Have a HUGE year through Yahoo! Small Business.
> http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Scott
stanlick@gmail.com

Re: Parameter interception

Posted by Dave Newton <ne...@yahoo.com>.
--- stanlick@gmail.com wrote:
> If I call an action with an id=20 parameter and that
> action contains both a field called id and a bean 
> that contains an id field, both fields are being set

> to 20. Does the parameter "setter" logic set 
> everything on the action object hierarchy that it
can
> find with the same name?

I don't think so; that could take an indeterminate
amount of time. 

I just wrote an Action with a Long id field and an
object that has a Long id field; if I pass in an id=5
just the Action's id field gets set. If I implement
ModelDriven then just the object's id field is set.

Are you using the default stack?

d.



 
____________________________________________________________________________________
Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

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