I hear what you are saying but my web application spans multiple action classes. I guess I could provide that method in all of my action classes but would this be considered best practice? Of course I could create my own extension of ActionSupport which has only that one method then have all of my Actions extend from it, but what alternatives do I have? Thanks Kris www.frameworks-boulder.org
-----Original Message-----
From: Mike Cannon-Brookes [mailto:[EMAIL PROTECTED]
Sent: Wed 9/24/2003 5:37 PM
To: [EMAIL PROTECTED]
Cc:
Subject: Re: [OS-webwork] JSP tag for viewing Session attributes?
Kris,
What you should do here is provide a getter method in your action, eg:
public User getUser() { return ActionContext.getSession().get(“user.key”);
}
And then in your views you can do user.firstName and it will use getUser() to
pull the value out of the session.
Cheers,
Mike
On 25/9/03 6:21 AM, "Thompson, Kris" ([EMAIL PROTECTED]) penned the words:
After a user logs in I place their User object in the session (thanks
to the ActionContext.getSession()) This works great except I also have in my header
on all of my JSP pages a tag like this
<ww:property value="user.FirstName" />
This tag works great right after I login because the property tag
pulls from the ValueStack. However on the next action invocation (or any there after)
that value is not longer in the ValueStack (because a ActionContext only lives as long
as a request) All that seems fine, but I need a way to get my value/attribute out of
my session object onto the page.
I could create an Interceptor that did nothing but pull the value from
the Session and place it in the stack on every invocation but that just doesn't seem
right.
Is my placement of the user object in the session wrong? Should I use
some sort of IoC impl. and specify the object to be session scope in the
components.xml?
Should I create a new tag that pulls from the session instead of the
stack?
Thanks
Kris
<<winmail.dat>>
