Scott,
That is definitly some great suggestions.. For a pageCounter, both
suggestions would be great... I looked at an earlier post I made, and the
response:
http://www.mail-archive.com/[email protected]/msg04250.html
and realized that I have been trying to figure out this question a couple
times.
I am looking for a more generic approach for any data. I don't think I can
use static, because I want each user to have their own data. So if I store
something that is specific to a screen and a user, I don't want to put the
data into the userobject, and can't make it static.
The post I reference mentioned putting the data into the context. While
that seems a little weird to be putting data into the context, and then
copying it out when I am reloading my screen, it would work. However, I
can't seem to get it to work. If I put something into the context, should
it be there when I reload the screen? Or do I have to do something weird
like put the data in hidden fields on a form or something?
I check the context with containsKey("pageCounter"), but always get false
back when I reload the page.
Eric
-----Original Message-----
From: Weaver, Scott [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 10:09 AM
To: 'Turbine Users List'
Subject: RE: Page Session Question
You might want to define the pageCounter as static within your screen class.
As long as everything is running in the same JVM, any changes made to the
static member variable will be perserved until the container is shut down.
You will probably want to write the pageCounter out to permanent storage
every so often as means to perserve it if the container is shut down.
Another, more OO way would be to create a PageHit class that records hits to
a HashTable using the Screen name as a key. Make it a singleton class with
protected constructors and static member variable that holds a reference to
itself. Also, implement serializable, so you could write the object to disk
to preserve it's state. Configure the class to write itself to disk after x
number of updates if the container goes down suddenly.
Just some suggestions,
Scott
-----Original Message-----
From: Pugh, Eric [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 9:42 AM
To: 'Turbine Users List'
Subject: Page Session Question
Hi all,
I seem to remember that with servlets, if I declare a private variable, and
then reload the servlet, the servlet remembers the variable. In otherwords,
a servlet can be made stateful...
Does a similar thing exist with screens? To preserve data across screens I
have put data in the user object. What about on a single screen?
I added a private int pageCounter = 0 to my screen. Then in the
doBuildTemplate method I increment the pageCounter, and put it in the
pageContext. However, when I reload the page, the pageCounter is always 1,
it never seems to increment.
How can I store data from one load of a screen to another? Putting stuff in
the userObject sometimes seems kinda clumsy.
Eric
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>