I don't use ModelDriven myself, but as I understand it, it places the Model Object at the top of the Value Stack, which would make userid be a reference to an attribute in the Model Object, not in the Action. When you use user.userid, it's because it's trying to find the user attribute in the Model Object (on the top of the Value Stack), which fails so it goes a step down the stack to the Action, where it finds a user attribute to use.
So, it appears Struts is functioning exactly as designed. (*Chris*) On Tue, Apr 26, 2011 at 12:55 PM, Dave Newton <davelnew...@gmail.com> wrote: > Doubt you're doing anything wrong; I'd expect it's how OGNL does its > lookup but haven't confirmed that. > > Dave > > On Tue, Apr 26, 2011 at 3:52 PM, Eric Lentz <eric.le...@sherwin.com> > wrote: > > - Struts 2.2.1 > > - Tomcat 6.0 > > - JDK 1.5.0_22 > > - Code example of the problem: http://pastebin.com/eyyJaBg4 > > - Description: > > I have two fields in my action class: user and userId. The user variable > > is of type User, which also contains a userId. In both cases userId is of > > type String. > > > > While implementing SessionAware and ModelDriven... > > > > Happy path: > > If I pass a parameter in the URL as follows: > > http://localhost:8080/Context/test-list.action?user.userId=foo > > > > Then user.userId = "foo" when it gets to the action. > > > > Not-so-happy path: > > If I pass a parameter in the URL as follows: > > http://localhost:8080/Context/test-list.action?userId=foo > > > > Then user.userId = "foo" when it gets to the action. > > > > Note that in both cases, "foo" was assigned to user.userId, though I used > > different keys in the URL each time! > > > > - Work-around: > > If I change either one of the names to something that is unique to the > > other, then it works as one would expect. > > > > Am I doing something wrong? > > > > - Eric > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >