Java Mailing List Archive

http://www.gg3721.com/

Home » users.tapestry »

Re: Best practice for onActivate and onPassivate without
persistence

Peter Stavrinides

2008-11-05

Replies: Find Java Web Hosting

Author LoginPost Reply
Thanks Thiago, its good to know its not using serialization, but the question remains, how does onPassivate retain those values? as far as I can tell that only leaves the request, anybody?

thanks,
Peter

----- Original Message -----
From: "Thiago H. de Paula Figueiredo" <thiagohp@(protected)>
To: "Tapestry users" <users@(protected)>
Sent: Tuesday, 4 November, 2008 4:46:25 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: Best practice for onActivate and onPassivate without persistence

Em Tue, 04 Nov 2008 09:31:36 -0300, Peter Stavrinides
<P.Stavrinides@(protected):

> Hi everyone,

Hi!

> I was wandering about best practice for passing multiple parameters to a
> page without using persist in the mix. Take the following example:
>
> void onActivate(Integer companyId, Integer siteId) throws SQLException {
>   _site = getSite(companyId,siteId);
> }
>
> CompanySite onPassivate(){
>  return _site;
> }  
>
> This works okay for my purposes... I like it because its stateless,
> however is CompanySite being serialized underneath?

AFAIK, no.

> String onPassivate(){
>   return _site.getCId() + "/" + _site.getSiteId();
> }  

It wouldn't work. Tapestry would handle it as a single String and scape
the / character. Then, your onActivate method, as written above, wouldn't
work. You should return an Object[] or List instead:

Object onPassivate(){
  return new Object[] {_site.getCId(), + _site.getSiteId()};
}  

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.