You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by an...@magnasteyr.com on 2006/04/25 12:25:49 UTC

Datatable and Request scope

I have a Datatable which has thousands of items in it. I get this items via a database. I don't want to store them in the session, because this will kill the session...
So I put it into request scope.. The problem now is the the datascroller doesn't work anymore, because I loose the list, because it's only in request scope...
What would be the best way to overcome this problem?

Regards,
Andy


++++++++++++++++++++++++++++++++++++++++++++++

This message is not legally binding upon our company!
This communication is confidential and is intended solely for the addressee(s). If you are not the intended recipient(s), his/her assistant, or authorized recipient, any form of disclosure, reproduction, distribution or any use of this communication or the information in it, is strictly prohibited and may be unlawful. In this case, please notify the sender immediately and destroy the e-mail. Electronic communication via the Internet by e-mail may be manipulated and/or read by third parties, thus we exclude any liability whatsoever for this e-mail.

++++++++++++++++++++++++++++++++++++++++++++++

Re: Datatable and Request scope

Posted by Geoff Longo <gm...@gmail.com>.
I agree.  However, if you read his question, it states that he was
"losing his data" because it was stored in the request.  Save state
fixes that.  It was never mentioned that the data was too large to
stay in the request.  But since it probably is, the solution you
provided is best.


On 4/25/06, Werner Punz <we...@gmx.at> wrote:
> Geoff Longo schrieb:
> > Have you looked into the saveState component?
> > http://wiki.apache.org/myfaces/SaveState
> >
> > On 4/25/06, Werner Punz <we...@gmx.at> wrote:
> >> andreas.mitter@magnasteyr.com schrieb:
> >>> I have a Datatable which has thousands of items in it. I get this items
> >>> via a database. I don't want to store them in the session, because this
> >>> will kill the session...
> >>>
> >>> So I put it into request scope.. The problem now is the the datascroller
> >>> doesn't work anymore, because I loose the list, because it's only in
> >>> request scope...
> >>>
> >>> What would be the best way to overcome this problem?
> >>>
> >> Using a datamodel overcomes this problem.
> >> There is a wiki entry in the myfaces wiki which describes exactly
> >> on how to write your own custom data models.
> >>
> >>
> >
> savestate does not make sense in this case, savestating thousands of
> datasets is quite a performance hit.
> A custom data model is way better for achiving the required results.
> The interfaces is somewhat generic though so it is a little bit of work
> to implement one of those.
>
>

Re: Datatable and Request scope

Posted by Werner Punz <we...@gmx.at>.
Geoff Longo schrieb:
> Have you looked into the saveState component? 
> http://wiki.apache.org/myfaces/SaveState
> 
> On 4/25/06, Werner Punz <we...@gmx.at> wrote:
>> andreas.mitter@magnasteyr.com schrieb:
>>> I have a Datatable which has thousands of items in it. I get this items
>>> via a database. I don't want to store them in the session, because this
>>> will kill the session...
>>>
>>> So I put it into request scope.. The problem now is the the datascroller
>>> doesn't work anymore, because I loose the list, because it's only in
>>> request scope...
>>>
>>> What would be the best way to overcome this problem?
>>>
>> Using a datamodel overcomes this problem.
>> There is a wiki entry in the myfaces wiki which describes exactly
>> on how to write your own custom data models.
>>
>>
> 
savestate does not make sense in this case, savestating thousands of
datasets is quite a performance hit.
A custom data model is way better for achiving the required results.
The interfaces is somewhat generic though so it is a little bit of work
to implement one of those.


Re: Datatable and Request scope

Posted by Geoff Longo <gm...@gmail.com>.
Have you looked into the saveState component? 
http://wiki.apache.org/myfaces/SaveState

On 4/25/06, Werner Punz <we...@gmx.at> wrote:
> andreas.mitter@magnasteyr.com schrieb:
> > I have a Datatable which has thousands of items in it. I get this items
> > via a database. I don't want to store them in the session, because this
> > will kill the session...
> >
> > So I put it into request scope.. The problem now is the the datascroller
> > doesn't work anymore, because I loose the list, because it's only in
> > request scope...
> >
> > What would be the best way to overcome this problem?
> >
>
> Using a datamodel overcomes this problem.
> There is a wiki entry in the myfaces wiki which describes exactly
> on how to write your own custom data models.
>
>

Re: Datatable and Request scope

Posted by Werner Punz <we...@gmx.at>.
Travis Reeder schrieb:
> I've been thinking about this same issue lately, it seems to me that the
> only component that must stores it's data in the session is the
> DataTable (the DataModel may be lazy, but it still must be in the
> session) and other Collection based components like dataList.  Other
> components don't necessarily have this requirement, you can bind
> output's and inputs to request based objects. 
> 
> I got to thinking how this issue could be overcome and generally in
> non-jsf apps, you use some "id" field in the object to identify the item
> in a list.  So what if you could specify on the dataTable an
> "identityField" attribute like <t:dataTable identityField="id"...   Then
> on the backend instead of trying to match up object identity, we can
> just match up the identityField.  This way, you could reload the data
> each request and wouldn't have to worry if the list changed in the
> database because you would only try to find the matching identity field. 
> 
I personally think this is a perfect case for a seam like conversation
based system, the same goes for the ejb3 entity manager or generally a
connection session handler.


Re: Datatable and Request scope

Posted by Adam Brod <AB...@intralinks.com>.
Jacob Hookom had a good post on this last week: 
http://weblogs.java.net/blog/jhook/archive/2006/04/possible_jsf_co_1.html

Adam Brod
Product Development Team


"Travis Reeder" <tr...@gmail.com> 
04/25/2006 04:55 PM
Please respond to
"MyFaces Discussion" <us...@myfaces.apache.org>


To
"MyFaces Discussion" <us...@myfaces.apache.org>, werpu@gmx.at
cc

Subject
Re: Datatable and Request scope






I've been thinking about this same issue lately, it seems to me that the 
only component that must stores it's data in the session is the DataTable 
(the DataModel may be lazy, but it still must be in the session) and other 
Collection based components like dataList.  Other components don't 
necessarily have this requirement, you can bind output's and inputs to 
request based objects. 

I got to thinking how this issue could be overcome and generally in 
non-jsf apps, you use some "id" field in the object to identify the item 
in a list.  So what if you could specify on the dataTable an 
"identityField" attribute like <t:dataTable identityField="id"...   Then 
on the backend instead of trying to match up object identity, we can just 
match up the identityField.  This way, you could reload the data each 
request and wouldn't have to worry if the list changed in the database 
because you would only try to find the matching identity field. 

Travis

On 4/25/06, Werner Punz <werpu@gmx.at > wrote:
Werner Punz schrieb:
> andreas.mitter@magnasteyr.com schrieb:
>> I have a Datatable which has thousands of items in it. I get this items 

>> via a database. I don't want to store them in the session, because this 

>> will kill the session...
>>
>> So I put it into request scope.. The problem now is the the 
datascroller
>> doesn't work anymore, because I loose the list, because it's only in
>> request scope... 
>>
>> What would be the best way to overcome this problem?
>>
>
> Using a datamodel overcomes this problem.
> There is a wiki entry in the myfaces wiki which describes exactly 
> on how to write your own custom data models.
>
>
sorry for the missing link, it took me a while to dig it out:

http://wiki.apache.org/myfaces/WorkingWithLargeTables 

or at least it should be I cannot reach the wiki currently :-(


Re: Datatable and Request scope

Posted by Travis Reeder <tr...@gmail.com>.
I've been thinking about this same issue lately, it seems to me that the
only component that must stores it's data in the session is the DataTable
(the DataModel may be lazy, but it still must be in the session) and other
Collection based components like dataList.  Other components don't
necessarily have this requirement, you can bind output's and inputs to
request based objects.

I got to thinking how this issue could be overcome and generally in non-jsf
apps, you use some "id" field in the object to identify the item in a list.
So what if you could specify on the dataTable an "identityField" attribute
like <t:dataTable identityField="id"...   Then on the backend instead of
trying to match up object identity, we can just match up the identityField.
This way, you could reload the data each request and wouldn't have to worry
if the list changed in the database because you would only try to find the
matching identity field.

Travis

On 4/25/06, Werner Punz <we...@gmx.at> wrote:
>
> Werner Punz schrieb:
> > andreas.mitter@magnasteyr.com schrieb:
> >> I have a Datatable which has thousands of items in it. I get this items
> >> via a database. I don't want to store them in the session, because this
>
> >> will kill the session...
> >>
> >> So I put it into request scope.. The problem now is the the
> datascroller
> >> doesn't work anymore, because I loose the list, because it's only in
> >> request scope...
> >>
> >> What would be the best way to overcome this problem?
> >>
> >
> > Using a datamodel overcomes this problem.
> > There is a wiki entry in the myfaces wiki which describes exactly
> > on how to write your own custom data models.
> >
> >
> sorry for the missing link, it took me a while to dig it out:
>
> http://wiki.apache.org/myfaces/WorkingWithLargeTables
>
> or at least it should be I cannot reach the wiki currently :-(
>
>

Re: Datatable and Request scope

Posted by Werner Punz <we...@gmx.at>.
Werner Punz schrieb:
> andreas.mitter@magnasteyr.com schrieb:
>> I have a Datatable which has thousands of items in it. I get this items
>> via a database. I don't want to store them in the session, because this
>> will kill the session...
>>
>> So I put it into request scope.. The problem now is the the datascroller
>> doesn't work anymore, because I loose the list, because it's only in
>> request scope...
>>
>> What would be the best way to overcome this problem?
>>
> 
> Using a datamodel overcomes this problem.
> There is a wiki entry in the myfaces wiki which describes exactly
> on how to write your own custom data models.
> 
> 
sorry for the missing link, it took me a while to dig it out:

http://wiki.apache.org/myfaces/WorkingWithLargeTables

or at least it should be I cannot reach the wiki currently :-(


Re: Datatable and Request scope

Posted by Werner Punz <we...@gmx.at>.
andreas.mitter@magnasteyr.com schrieb:
> I have a Datatable which has thousands of items in it. I get this items
> via a database. I don't want to store them in the session, because this
> will kill the session...
> 
> So I put it into request scope.. The problem now is the the datascroller
> doesn't work anymore, because I loose the list, because it's only in
> request scope...
> 
> What would be the best way to overcome this problem?
> 

Using a datamodel overcomes this problem.
There is a wiki entry in the myfaces wiki which describes exactly
on how to write your own custom data models.