Struts 2 - Accessing different properties on the ValueStack sharing the same name
Posted
by veggen
on Stack Overflow
See other posts from Stack Overflow
or by veggen
Published on 2010-05-30T14:28:23Z
Indexed on
2010/05/30
14:32 UTC
Read the original article
Hit count: 155
Struts 2 will resolve all property names during view rendering against the top object in the ValueStack first. But how can one access a property with the same name on the object lower on the stack?
Example:
Let's say I have an Action class called MyAction and it has a a logDate property. In the view rendered after this action is invoked, there's this:
Now imagine a User object also has a logDate property. During the iteration, Struts 2 will always push the current user object to the top of the ValueStack effectively resolving all property names against it. But, what if I wanted to access logDate from the action? What's the correct way to do this?
© Stack Overflow or respective owner