I don't know if it's common practice to send thank you's in a mailing list, but 
screw it. Thanks! I'm pretty sure I'll be using much more of Tapestry in the 
future.

Sotirios

Date: Mon, 26 Nov 2012 13:08:55 -0800
From: ml-node+s1045711n5718303...@n5.nabble.com
To: sotodel...@hotmail.com
Subject: Re: SessionState



        On Mon, 26 Nov 2012 18:45:14 -0200, Pillar <[hidden email]> wrote:


> Hi,


Hi!


> In the Tapestry User Guide for  session storage

> <http://tapestry.apache.org/session-storage.html>  , it states "Any other

> component or page that declares a field of the same type, regardless of

> name, and marks it with the SessionState annotation will share the same

> value." I have the following Page class:

>

> public class Page {

>     @SessionState

>     private User loggedInUser;

>    @SessionState

>     private User buddy;

> }

>

> Am I understanding correctly that both of these instances of User will be

> the same?

Exactly the same. The actual name of the session attribute (which you  

should consider completely irrelevant) is based on the fully-qualified  

class name. The field name is ignored.


> And that if I want them to be different, I have to encapsulate

> them in another class, add an instance variable of that class to my Page

> class, and annotate it as SessionState?


Yep. Or just create another class, for example, UserState, with two  

different fields, loggedInUser and buddy, and don't have an User in the  

@SessionState directly, so you have a single place for looking for the  

current logged in user.


I've been working with Tapestry 5 since the first alphas. @SessionState  

works exactly in the same way since then, almost 5 years ago. I've *never*  

needed two different instances of the same class in the session.


-- 

Thiago H. de Paula Figueiredo


---------------------------------------------------------------------

To unsubscribe, e-mail: [hidden email]

For additional commands, e-mail: [hidden email]




        
        
        
        

        

        
        
                If you reply to this email, your message will be added to the 
discussion below:
                
http://tapestry.1045711.n5.nabble.com/SessionState-tp5718302p5718303.html
        
        
                
                To unsubscribe from SessionState, click here.

                NAML
                                                  



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/SessionState-tp5718302p5718304.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Reply via email to