tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Piterman <rpiter...@gmx.net>
Subject Re: Difference between @Persist("session") and @InjectState(<property_name>) ?
Date Thu, 02 Mar 2006 09:34:39 GMT
a persistant property (session) is tied to a single component on a 
single page - also if you use it inside a component, when using the same 
component on another page the value will not be kept.

a state object is shared by all components/pages.

Cheers,
Ron


Adam Zimowski wrote:
> Hi,
> 
> I noticed that whether I do:
> 
> @Persist("session")
> public abstract void setMemberId(Long id);
> 
> or
> 
> @InjectState("memberId")
> public abstract void setMemberId(Long id);
> 
> new session is created.  However, my:
> 
> @InjectStateFlag("memberId")
> public abstract boolean isLoggedIn();
> 
> returns true only if I set member id thru @InjectState, but returns
> false if I set the member id thru @Persist("session").  I don't
> understand why, afterall both are creating a session attribute right? 
> And if so, how come my HttpSessionAttributeListener is not reporting
> anything no matter how I set member id? Yet HttpSessionListener
> clearly shows that session does get created.
> 
> public class HttpSessionSniffer extends LogableObject implements
> HttpSessionListener, HttpSessionAttributeListener {
> 
> 	public void sessionCreated(HttpSessionEvent arg0) {
> 		if (sDbg())
> 			_sLog.debug("session created: " + arg0.getSession().getId());
> 	}
> 	public void attributeAdded(HttpSessionBindingEvent arg0) {
> 		if (sDbg())
> 			_sLog.debug(arg0.getName() + " " + (String) arg0.getValue());
> 	}
> 	public void attributeRemoved(HttpSessionBindingEvent arg0) {
> 		if (sDbg())
> 			_sLog.debug(arg0.getName() + " " + (String) arg0.getValue());
> 	}
> 	public void attributeReplaced(HttpSessionBindingEvent arg0) {
> 		if (sDbg())
> 			_sLog.debug(arg0.getName() + " " + (String) arg0.getValue());
> 	}
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Mime
View raw message