You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Julio C. Rivera" <ju...@ya.com> on 2003/06/15 00:09:49 UTC

Save table state between requests

Hi!

I'm developing a component which have a table component inside.
This component show data from a database query dynamically. Table columns 
are sortables, therefore I need to save the table state between request. I 
supose I have to use a SimpleTableSessionStateManager, but then I have to 
store it somewhere. I would like my component was a black box, therefore I 
don't want it use the Visit object.

Where can I store the SimpleTableSessionStateManager?

Thanks,
    Julio.


Re: Save table state between requests

Posted by "Julio C. Rivera" <ju...@ya.com>.
Yes, that helps a lot.

After read (once more) the documentation and your message I have resolved 
the problem.

Thanks!

At 01:38 15/06/2003 +0300, you wrote:
>Hi Julio,
>
>The following is from a message sent a while ago, but I think it will answer
>your questions.
>
>Just some background for other people who may be reading: the Session State
>Manager determines what part of the model will be saved in the session, and
>what part will be "recreated" when the next request occurs. This helps you
>control the size of the session data.
>
>For example, the FullTableSessionStateManager saves _everything_ into the
>session -- data, column model, paging and sorting state. This is the
>simplest approach, but it is obviously not desirable if the data is big and
>the column model is constant.
>
>The SimpleTableSessionStateManager saves only the paging and sorting state,
>which is tiny, and assumes that both the column model and the data model
>(but not necessarily the data itself) are constant. It uses them together
>with the table state to recreate the full table model every time it is
>required (usually at the beginning of a new request).
>
>The most common case where you can use this session manager is when you
>display data from a database. To do this, create a custom TableDataModel
>that loads the data from the database (see below). Create just one instance
>per application (or per component/page) of the TableDataModel and the
>TableColumnModel that defines the table columns. Then create just one
>instance of the SimpleTableSessionStateManager using those two objects in
>its constructor. That object is then passed as a 'tableSessionStateManager'
>binding to the table component. One place that can be used to initialize
>those objects is finishLoad() -- it will be done once, rather than at every
>request.
>
>To implement a custom TableDataModel, you can start by extending
>AbstractTableDataModel (which takes care of the pesky listener methods) and
>override the methods getTableRows() and getTableRowsCount() to load the
>data. That's all.
>
>Please keep in mind that in this approach it is the table model that
>performs the sorting of the data. If your persistence method allows data to
>be extracted already sorted and possibly limited to the current page, it
>would probably be best to create your own implementation of a table model
>that uses the table state to perform those actions. As I have mentioned
>earlier, there is now such a model that uses plain SQL to load its data.
>
>I hope that helps.
>
>Best regards,
>-mb
>
>
>----- Original Message -----
>From: "Julio C. Rivera" <ju...@ya.com>
>To: <ta...@jakarta.apache.org>
>Sent: Sunday, June 15, 2003 1:09 AM
>Subject: Save table state between requests
>
>
> > Hi!
> >
> > I'm developing a component which have a table component inside.
> > This component show data from a database query dynamically. Table columns
> > are sortables, therefore I need to save the table state between request. I
> > supose I have to use a SimpleTableSessionStateManager, but then I have to
> > store it somewhere. I would like my component was a black box, therefore I
> > don't want it use the Visit object.
> >
> > Where can I store the SimpleTableSessionStateManager?
> >
> > Thanks,
> >     Julio.
> >
> >
> > ---------------------------------------------------------------------
> > 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


Re: Save table state between requests

Posted by Mindbridge <mi...@yahoo.com>.
Hi Julio,

The following is from a message sent a while ago, but I think it will answer
your questions.

Just some background for other people who may be reading: the Session State
Manager determines what part of the model will be saved in the session, and
what part will be "recreated" when the next request occurs. This helps you
control the size of the session data.

For example, the FullTableSessionStateManager saves _everything_ into the
session -- data, column model, paging and sorting state. This is the
simplest approach, but it is obviously not desirable if the data is big and
the column model is constant.

The SimpleTableSessionStateManager saves only the paging and sorting state,
which is tiny, and assumes that both the column model and the data model
(but not necessarily the data itself) are constant. It uses them together
with the table state to recreate the full table model every time it is
required (usually at the beginning of a new request).

The most common case where you can use this session manager is when you
display data from a database. To do this, create a custom TableDataModel
that loads the data from the database (see below). Create just one instance
per application (or per component/page) of the TableDataModel and the
TableColumnModel that defines the table columns. Then create just one
instance of the SimpleTableSessionStateManager using those two objects in
its constructor. That object is then passed as a 'tableSessionStateManager'
binding to the table component. One place that can be used to initialize
those objects is finishLoad() -- it will be done once, rather than at every
request.

To implement a custom TableDataModel, you can start by extending
AbstractTableDataModel (which takes care of the pesky listener methods) and
override the methods getTableRows() and getTableRowsCount() to load the
data. That's all.

Please keep in mind that in this approach it is the table model that
performs the sorting of the data. If your persistence method allows data to
be extracted already sorted and possibly limited to the current page, it
would probably be best to create your own implementation of a table model
that uses the table state to perform those actions. As I have mentioned
earlier, there is now such a model that uses plain SQL to load its data.

I hope that helps.

Best regards,
-mb


----- Original Message ----- 
From: "Julio C. Rivera" <ju...@ya.com>
To: <ta...@jakarta.apache.org>
Sent: Sunday, June 15, 2003 1:09 AM
Subject: Save table state between requests


> Hi!
>
> I'm developing a component which have a table component inside.
> This component show data from a database query dynamically. Table columns
> are sortables, therefore I need to save the table state between request. I
> supose I have to use a SimpleTableSessionStateManager, but then I have to
> store it somewhere. I would like my component was a black box, therefore I
> don't want it use the Visit object.
>
> Where can I store the SimpleTableSessionStateManager?
>
> Thanks,
>     Julio.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: [tapestry] Save table state between requests

Posted by "Julio C. Rivera" <ju...@ya.com>.
I don't like to use HttpSession in Tapestry. I think it is a very low level 
action.
I think Tapestry has "high level" mechanisms  for managing  pesistent data 
(persistent properties, visit object, ...).

I have resolved the problem without need of store the 
SimpleTableSessionStateManager. The key is in the TableView component. It 
stores and loads the state in/from a persistent property, helped by a 
TableSessionStateManager for extracting the state and recreating the 
TableModel.

Regards.
    Julio.

At 01:54 15/06/2003 -0400, you wrote:
>At 6/15/2003 12:09 AM $4, you wrote:
>>Hi!
>>
>>I'm developing a component which have a table component inside.
>>This component show data from a database query dynamically. Table columns 
>>are sortables, therefore I need to save the table state between request. 
>>I supose I have to use a SimpleTableSessionStateManager, but then I have 
>>to store it somewhere. I would like my component was a black box, 
>>therefore I don't want it use the Visit object.
>>
>>Where can I store the SimpleTableSessionStateManager?
>
>You could store it in the HttpSession? Is this considered bad form for 
>Tapestry?
>
>J
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Re: Article about Tapestry

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

> >     Is there a direct link to the article on the website or is it only
in
> > the print edition?
>
> only in print. However, since you asked so insistently, I've put it up
> on my site at http://www.dynabean.de/download.html - theres also an
> online HTML version, and a conference presentation on the same subject

Thank you Christian. Very much appreciated.

I have had a quick read through the article. My initial reaction is that
your classification of the web frameworks is very solid and very useful.

Re: Article about Tapestry

Posted by Christian Sell <ch...@netcologne.de>.
Mindbridge wrote:
> Hi Christian,
> 
>     Is there a direct link to the article on the website or is it only in
> the print edition?

only in print. However, since you asked so insistently, I've put it up 
on my site at http://www.dynabean.de/download.html - theres also an 
online HTML version, and a conference presentation on the same subject

> 
>     I managed to view the site in English using Google
> (http://translate.google.com/translate?u=http%3A%2F%2Fwww.javamagazin.de%2F&
> langpair=de%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools), but I
> cannot find the article -- only managed to download the sources of the
> examples.
> 
>     Good work, btw :)
> 
> -mb
> 
> 
> ----- Original Message ----- 
> From: "Christian Sell" <ch...@netcologne.de>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, June 17, 2003 8:12 PM
> Subject: Re: Article about Tapestry
> 
> 
> 
>>Detlef Schulze wrote:
>>
>>>... just wanted to let you guys know that there is an article about web
>>>frameworks in the current issue of the german "Java Magazin"
>>>(http://www.javamagazin.de/).
>>>
>>>The author compares different frameworks like Struts, WebWorks and
> 
> Tapestry
> 
>>>(and some more). Most of the article is about tapestry, and its very
>>>positive about it.
>>
>>it sure is ;-). I bet it would be fun reading it after it was run
>>through babelfish.
>>
>>
>>>cheers,
>>>Detlef
>>>
>>>
>>>---------------------------------------------------------------------
>>>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
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 



Re: Article about Tapestry

Posted by Mindbridge <mi...@yahoo.com>.
Hi Christian,

    Is there a direct link to the article on the website or is it only in
the print edition?

    I managed to view the site in English using Google
(http://translate.google.com/translate?u=http%3A%2F%2Fwww.javamagazin.de%2F&
langpair=de%7Cen&hl=en&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools), but I
cannot find the article -- only managed to download the sources of the
examples.

    Good work, btw :)

-mb


----- Original Message ----- 
From: "Christian Sell" <ch...@netcologne.de>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, June 17, 2003 8:12 PM
Subject: Re: Article about Tapestry


> Detlef Schulze wrote:
> > ... just wanted to let you guys know that there is an article about web
> > frameworks in the current issue of the german "Java Magazin"
> > (http://www.javamagazin.de/).
> >
> > The author compares different frameworks like Struts, WebWorks and
Tapestry
> > (and some more). Most of the article is about tapestry, and its very
> > positive about it.
>
> it sure is ;-). I bet it would be fun reading it after it was run
> through babelfish.
>
> >
> > cheers,
> > Detlef
> >
> >
> > ---------------------------------------------------------------------
> > 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


Re: Article about Tapestry

Posted by Christian Sell <ch...@netcologne.de>.
Detlef Schulze wrote:
> ... just wanted to let you guys know that there is an article about web
> frameworks in the current issue of the german "Java Magazin"
> (http://www.javamagazin.de/).
> 
> The author compares different frameworks like Struts, WebWorks and Tapestry
> (and some more). Most of the article is about tapestry, and its very
> positive about it.

it sure is ;-). I bet it would be fun reading it after it was run 
through babelfish.

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



Article about Tapestry

Posted by Detlef Schulze <de...@jaide.de>.
... just wanted to let you guys know that there is an article about web
frameworks in the current issue of the german "Java Magazin"
(http://www.javamagazin.de/).

The author compares different frameworks like Struts, WebWorks and Tapestry
(and some more). Most of the article is about tapestry, and its very
positive about it.

cheers,
Detlef


Re: [tapestry] Save table state between requests

Posted by J <we...@fluidic.com>.
At 6/15/2003 12:09 AM $4, you wrote:
>Hi!
>
>I'm developing a component which have a table component inside.
>This component show data from a database query dynamically. Table columns 
>are sortables, therefore I need to save the table state between request. I 
>supose I have to use a SimpleTableSessionStateManager, but then I have to 
>store it somewhere. I would like my component was a black box, therefore I 
>don't want it use the Visit object.
>
>Where can I store the SimpleTableSessionStateManager?

You could store it in the HttpSession? Is this considered bad form for 
Tapestry?

J