Title: 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



Reply via email to