In Manning's book Struts2 in Action page 106 it is mentioned like
If you look at this in figure 5.1, you might expect that the expression would need to be something more like
myAction.user.username
. To the contrary, only the user.username necessary. This is because theValueStack
is a sort of virtual object that exposes the properties of its contained objects as its own.
and in the same lines it also says
If duplicate properties exist—two objects in the stack both have a name property—then the property of the highest object in the stack will be the one exposed on the virtual object represented by the
ValueStack
.
My doubt is if we can use user.username
as described in the first paragraph, then there can be another username but of different class. Which can again be accessed with objectname.user
syntax. Then why they are mentioning the problem of duplicate properties?