This feature was just added a couple days ago, so unless you have the very latest it wouldn't work.


From: "Thompson, Kris" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: RE: [OS-webwork] JSP tag for viewing Session attributes?
Date: Thu, 25 Sep 2003 09:03:39 -0600

I was unable to get this to work and however the solution that Mike C. gave worked. Thanks for the help.

Kris

-----Original Message-----
From: Pat Lightbody [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 24, 2003 11:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [OS-webwork] JSP tag for viewing Session attributes?


Yes, you can now do:


<ww:property value="session['user.key'].firstName"/>

-Pat


----- Original Message ----- From: Jason Carreira <mailto:[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Sent: Wednesday, September 24, 2003 8:52 PM Subject: RE: [OS-webwork] JSP tag for viewing Session attributes?

Patrick, did you add support for accessing items from the session to the expression language?

-----Original Message-----
From: Thompson, Kris [mailto:[EMAIL PROTECTED] On Behalf Of Thompson, Kris
Sent: Wednesday, September 24, 2003 11:48 PM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] JSP tag for viewing Session attributes?



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








_________________________________________________________________
Frustrated with dial-up? Get high-speed for as low as $29.95/month (depending on the local service providers in your area). https://broadband.msn.com




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to