You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Yee CN <ye...@streamyx.com> on 2005/11/01 03:40:37 UTC

RE: Problem: DataTable binds too early...

Yes - you are right. I was flushing the hibernate cache a bit too late.

I am thinking calling getUserList() twice sounds a bit wasteful. It probably
won't hit the database again with hibernate caching, but I am thinking for
these mega objects maybe the value="#{userBean.userList}" binding is perhaps
not a good idea. Setting the binding with user code would be better where
performance is a concern. It is something to think about.

Thanks again.

Regards,
Yee

-----Original Message-----
From: Mathias Brökelmann [mailto:mbroekelmann@googlemail.com] 
Sent: Tuesday, 1 November 2005 3:37 AM
To: MyFaces Discussion
Subject: Re: Problem: DataTable binds too early...

the datatable will call getUserList() a second time when the new
response is rendered. It is the user who has to return the right
list/datemodel on the second time without the deleted entries in the
list.

2005/10/31, Yee CN <ye...@streamyx.com>:
>
>
>
> Hi,
>
>
>
> I am facing the following problem, and I hope someone can show me how to
> achieve this in JSF.
>
>
>
> Scenario – A jsf page with a <t:dataTable> of users. One column is a
delete
> button, which deletes a row, and navigate back to the same page.
>
>
>
> Problem: When the delete button is pressed, the order of execution seems
to
> be the following:
>
> -          The page does a postback
>
> -          The backing bean is constructed
>
> -          Restoring view: <t:dataTable> invoke getUserList() and
populates
> the table
>
> -          Applicaton action: deleteUserAction() is invoked
>
>
>
> The result is that the data table is showing the deleted user!
>
>
>
> As a point of reference, in ASP.NET the binding to data table is done
> explicitly in code so the programmer can decide the timing of binding the
> data table. How do I achieve the same in jsf?
>
>
>
> Thanks in advance
>
>
>
> Yee
>
>


--
Mathias


Re: Problem: DataTable binds too early...

Posted by Mathias Brökelmann <mb...@googlemail.com>.
the first call is needed to decode, validate and update the datamodel.
This can only be done if the datamodel is available. The second call
is required to allow the user to update the datamodel (sorting,
deleting, or adding rows). It is left to the user if a db call is
required to fetch the data for the second call. This can also work for
very large data by providing a custom DataModel implementation which
contains only the row data which is currently displayed or processed -
you could use t:datascroller with an actionlistener for that.

2005/11/1, Yee CN <ye...@streamyx.com>:
> Yes - you are right. I was flushing the hibernate cache a bit too late.
>
> I am thinking calling getUserList() twice sounds a bit wasteful. It probably
> won't hit the database again with hibernate caching, but I am thinking for
> these mega objects maybe the value="#{userBean.userList}" binding is perhaps
> not a good idea. Setting the binding with user code would be better where
> performance is a concern. It is something to think about.
>
> Thanks again.
>
> Regards,
> Yee
>
> -----Original Message-----
> From: Mathias Brökelmann [mailto:mbroekelmann@googlemail.com]
> Sent: Tuesday, 1 November 2005 3:37 AM
> To: MyFaces Discussion
> Subject: Re: Problem: DataTable binds too early...
>
> the datatable will call getUserList() a second time when the new
> response is rendered. It is the user who has to return the right
> list/datemodel on the second time without the deleted entries in the
> list.
>
> 2005/10/31, Yee CN <ye...@streamyx.com>:
> >
> >
> >
> > Hi,
> >
> >
> >
> > I am facing the following problem, and I hope someone can show me how to
> > achieve this in JSF.
> >
> >
> >
> > Scenario – A jsf page with a <t:dataTable> of users. One column is a
> delete
> > button, which deletes a row, and navigate back to the same page.
> >
> >
> >
> > Problem: When the delete button is pressed, the order of execution seems
> to
> > be the following:
> >
> > -          The page does a postback
> >
> > -          The backing bean is constructed
> >
> > -          Restoring view: <t:dataTable> invoke getUserList() and
> populates
> > the table
> >
> > -          Applicaton action: deleteUserAction() is invoked
> >
> >
> >
> > The result is that the data table is showing the deleted user!
> >
> >
> >
> > As a point of reference, in ASP.NET the binding to data table is done
> > explicitly in code so the programmer can decide the timing of binding the
> > data table. How do I achieve the same in jsf?
> >
> >
> >
> > Thanks in advance
> >
> >
> >
> > Yee
> >
> >
>
>
> --
> Mathias
>
>


--
Mathias