You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Mark Lybarger <Ma...@CBC-Companies.com> on 2003/03/05 18:05:39 UTC

using session data

i recently started to use $data.getUser().getTemp("tempObject") in my
velocity template, and data.getUser().setTemp("tempObject") in my action
classes.  

Are there any drawbacks to using this approach of putting data out there for
the templates to use?  this seems _much_ easier than using our former
approach of making each action class put data into the context that the next
form will need, so there's got to be a drawback somewhere.


Mark Lybarger
Mark.Lybarger@cbc-companies.com
CBC Companies
614.442.3741

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003
 

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


Re: using session data

Posted by Johnny Quazar <qu...@bitblaster.com>.
Hey Mark,

I too will be interested to see what the more experienced folks have 
to say. I settled for using messages, at least in some cases:

Action:

   data.setMessage("myMessageType=" + dataToPass);
   TemplateScreen.setTemplate(data, "MyScreen.vm");

Screen:
   if (data.hasMessage()) {
     String msg = data.getMessage();
     // use StringTokenizer to check and parse the data
     // if appropriate, add something to context

Flexible, perhaps lame. Seems cheap and easy though, and the scope is 
much more limited than set/getTemp.


At 12:05 PM -0500 3/5/03, Mark Lybarger wrote:
>i recently started to use $data.getUser().getTemp("tempObject") in my
>velocity template, and data.getUser().setTemp("tempObject") in my action
>classes. 
>
>Are there any drawbacks to using this approach of putting data out there for
>the templates to use?  this seems _much_ easier than using our former
>approach of making each action class put data into the context that the next
>form will need, so there's got to be a drawback somewhere.
>
>
>Mark Lybarger
>Mark.Lybarger@cbc-companies.com
>CBC Companies
>614.442.3741
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.459 / Virus Database: 258 - Release Date: 2/25/2003
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: turbine-user-help@jakarta.apache.org


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


Re: using session data

Posted by "Jeffrey D. Brekke" <jb...@wi.rr.com>.
Yes, use pull tools.  You can have the entire tool pulled in and out
of the session for you.  So it is available to the template and
accessible in your action.  We are generally creating our model
objects and once we have a need for accessing some of the data we
either make the appropriate object a application tool object or create
a thin object that delagates to the model for the tool.

I've found that I loose track of all the junk I through in the session
when I have get/setTemp's littered everywhere.

>>>>> On Wed, 5 Mar 2003 10:42:55 -0700, "Chris K Chew" <ch...@fenetics.com> said:

> Try looking into pull tools.  Their advantages are easy get/set
> methods, options for how long things live (per request, per session,
> or persistent), and it provides a more explicit framework for what
> is available to templates.

> You will find lots of info in the pull howto, reading the code for
> pull tools like $intake, and reading the user list archives.

> Onward and upward,

> Chris


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

-- 
=====================================================================
Jeffrey D. Brekke                                   jbrekke@wi.rr.com
Wisconsin,  USA                                     brekke@apache.org
                                                    ekkerbj@yahoo.com


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


RE: using session data

Posted by Chris K Chew <ch...@fenetics.com>.
Try looking into pull tools.  Their advantages are easy get/set methods,
options for how long things live (per request, per session, or persistent),
and it provides a more explicit framework for what is available to
templates.

You will find lots of info in the pull howto, reading the code for pull
tools like $intake, and reading the user list archives.

Onward and upward,

Chris


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