You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Adam Zimowski <zi...@gmail.com> on 2010/09/14 18:25:58 UTC

SessionState for simple types

I understand that @SessionState was meant for POJOs. What's the
preferred (if any) way in Tapestry to store Strings, Integers and such
across multiple pages?

Adam

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


Re: SessionState for simple types

Posted by Adam Zimowski <zi...@gmail.com>.
Yes! I forgot about that. Works like a charm :)

On Tue, Sep 14, 2010 at 1:46 PM, Guerin Laurent <lg...@sopragroup.com> wrote:
> Hi,
>
> From tapestry 5.2 you can use @SessionAttribute.
>
> Envoyé de mon iPhone
>
> Le 14 sept. 2010 à 20:34, "Adam Zimowski" <zi...@gmail.com> a écrit :
>
>>> I find it both easy and self-descriptive to write wrapper classes for
>>> these java objects.
>>
>> That's exactly what I'm trying to avoid. With a large team of junior
>> programmers this will be a maintenance nightmare.
>>
>>> You could always grab the HttpSession and store them yourself.
>>
>> From my searching the mailing list, this seems like the only viable
>> option. I try to stay away from using Servlet API, but may have to as
>> a work around. Anything better?
>>
>> Adam
>>
>> On Tue, Sep 14, 2010 at 11:42 AM, Josh Canfield <jo...@gmail.com>
>> wrote:
>>>>
>>>> I understand that @SessionState was meant for POJOs. What's the
>>>> preferred (if any) way in Tapestry to store Strings, Integers and such
>>>> across multiple pages?
>>>
>>> It really depends on the use case. If you can bundle them up into a
>>> class that'd be the best way. For instance, if you're storing some
>>> shared user configuration you could create a UserConfiguration object
>>> with the values. Your class could be a simple wrapper around
>>> Properties, or a Map if you need something more flexible than fixed
>>> properties.
>>>
>>> You could always grab the HttpSession and store them yourself...
>>>
>>>
>>>>
>>>> Adam
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> --
>>> http://www.bodylabgym.com - a private, by appointment only, one-on-one
>>> health and fitness facility.
>>> --
>>> http://www.ectransition.com - Quality Electronic Cigarettes at a
>>> reasonable price!
>>> --
>>> TheDailyTube.com. Sign up and get the best new videos on the internet
>>> delivered fresh to your inbox.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>

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


Re: SessionState for simple types

Posted by Guerin Laurent <lg...@sopragroup.com>.
Hi,

 From tapestry 5.2 you can use @SessionAttribute.

Envoyé de mon iPhone

Le 14 sept. 2010 à 20:34, "Adam Zimowski" <zi...@gmail.com> a  
écrit :

>> I find it both easy and self-descriptive to write wrapper classes  
>> for these java objects.
>
> That's exactly what I'm trying to avoid. With a large team of junior
> programmers this will be a maintenance nightmare.
>
>> You could always grab the HttpSession and store them yourself.
>
> From my searching the mailing list, this seems like the only viable
> option. I try to stay away from using Servlet API, but may have to as
> a work around. Anything better?
>
> Adam
>
> On Tue, Sep 14, 2010 at 11:42 AM, Josh Canfield <joshcanfield@gmail.com 
> > wrote:
>>> I understand that @SessionState was meant for POJOs. What's the
>>> preferred (if any) way in Tapestry to store Strings, Integers and  
>>> such
>>> across multiple pages?
>>
>> It really depends on the use case. If you can bundle them up into a
>> class that'd be the best way. For instance, if you're storing some
>> shared user configuration you could create a UserConfiguration object
>> with the values. Your class could be a simple wrapper around
>> Properties, or a Map if you need something more flexible than fixed
>> properties.
>>
>> You could always grab the HttpSession and store them yourself...
>>
>>
>>>
>>> Adam
>>>
>>> --- 
>>> ------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> --
>> http://www.bodylabgym.com - a private, by appointment only, one-on- 
>> one
>> health and fitness facility.
>> --
>> http://www.ectransition.com - Quality Electronic Cigarettes at a
>> reasonable price!
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

Re: SessionState for simple types

Posted by Adam Zimowski <zi...@gmail.com>.
> I find it both easy and self-descriptive to write wrapper classes for these java objects.

That's exactly what I'm trying to avoid. With a large team of junior
programmers this will be a maintenance nightmare.

> You could always grab the HttpSession and store them yourself.

>From my searching the mailing list, this seems like the only viable
option. I try to stay away from using Servlet API, but may have to as
a work around. Anything better?

Adam

On Tue, Sep 14, 2010 at 11:42 AM, Josh Canfield <jo...@gmail.com> wrote:
>> I understand that @SessionState was meant for POJOs. What's the
>> preferred (if any) way in Tapestry to store Strings, Integers and such
>> across multiple pages?
>
> It really depends on the use case. If you can bundle them up into a
> class that'd be the best way. For instance, if you're storing some
> shared user configuration you could create a UserConfiguration object
> with the values. Your class could be a simple wrapper around
> Properties, or a Map if you need something more flexible than fixed
> properties.
>
> You could always grab the HttpSession and store them yourself...
>
>
>>
>> Adam
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> --
> http://www.bodylabgym.com - a private, by appointment only, one-on-one
> health and fitness facility.
> --
> http://www.ectransition.com - Quality Electronic Cigarettes at a
> reasonable price!
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: SessionState for simple types

Posted by Josh Canfield <jo...@gmail.com>.
> I understand that @SessionState was meant for POJOs. What's the
> preferred (if any) way in Tapestry to store Strings, Integers and such
> across multiple pages?

It really depends on the use case. If you can bundle them up into a
class that'd be the best way. For instance, if you're storing some
shared user configuration you could create a UserConfiguration object
with the values. Your class could be a simple wrapper around
Properties, or a Map if you need something more flexible than fixed
properties.

You could always grab the HttpSession and store them yourself...


>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
http://www.bodylabgym.com - a private, by appointment only, one-on-one
health and fitness facility.
--
http://www.ectransition.com - Quality Electronic Cigarettes at a
reasonable price!
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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


Re: SessionState for simple types

Posted by Rich M <ri...@moremagic.com>.
I'm not sure if this is the recommended way, but I find it both easy and 
self-descriptive to write wrapper classes for these java objects so you 
can use either SessionState or the Environment to move them across pages 
in the application. For example, if you have a String for the name of 
the user logged in and want to use it on several pages, write a wrapper 
class called UserName with a field for the name and setter/getter 
methods. You can then pass this around as a POJO as I mentioned before.

It might be slightly annoying to have a handful of wrapper classes like 
this. But on the other hand it provides a central location that can be 
referenced in the project using an IDE that helps keep track of the 
various objects you pass around the pages, rather than digging through 
all your page classes looking.

-Rich

On 09/14/2010 12:25 PM, Adam Zimowski wrote:
> I understand that @SessionState was meant for POJOs. What's the
> preferred (if any) way in Tapestry to store Strings, Integers and such
> across multiple pages?
>
> Adam
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>    


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