sorry, there was a typo in my example, the property value should be
userInfo.displayName.
On 9/6/07, joe bob [EMAIL PROTECTED] wrote:
Hello,
I have been using struts 2.0.9 to build my application. In all of my
JSPs I would like to display a welcome page involving a user name. I already
have an action to get/set this value so I would like to do the following in
a JSP included in all of my other JSPs:
s:action name=UserInfo!getInfo namespace=/user executeResult=false
id=userInfo/
Welcome, s:property value=userpref.displayName/
However, this doesn't seem to work. My action is called and executes
properly, but the property tag does not produce a value. Through some
stepping through of struts classes, I see that actions called via the action
tag are placed in the value stack context and not pushed onto the stack.
When extracting values, the context map is queried with the full
userpref.displayName string, i.e. the dot notation is not honored as it
is when finding a value in the stack.
Is there any way to do this nicely? Or should I re-factor my actions so
that a super class of all my actions performs the user name lookup and
exposes it through a getter? Then I would use the main (?) action and not
have the action tag in the JSP.