File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes DataTable datas are not actual Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "DataTable datas are not actual" Watch "DataTable datas are not actual" New topic
Author

DataTable datas are not actual

Karoly Guba
Greenhorn

Joined: Dec 09, 2011
Posts: 5
Hi!

I work on a small project now. This software registers a client who is enter into the office (datetime, name, id, destination). The registration process is OK, but I have problems with reports showed in dataTable.
How the report works:

When I click on report, the browser shows me report about how many clients have each official today(you can see it on the following picture):



When I click on one official, the browser shows me another page with the list of clients visited that official (you can see it on the following pic):



Lets get back to the first report (how many clients have each official today). Of course there is a possibility to change the date range. Lets say that I want to see how many clients have each official from 6 of december to 9 of december. For this I get the following:




Everything is OK till this point, but if I click on one official I get the list of clients visited another official. What I noticed is that when I click on an official I get the client list of another official who was on this position later when I started report (how many clients have each official TODAY). For example if I click on a "Томашев Рожа" I get clients of "Ђенге Терез".

Here is the code of report JSF (how many clients have each official today):
Sumarno.xhtml



Code of client list JSF:
klienti.xhtml



Code of managed bean destinationManager:



Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

This is a very well described question. I think you need to use f:setPropertyActionListener as a child tag of
the h:commandLink to set a backing bean value (target=) to the value of the table row (source="#{var}").
Karoly Guba
Greenhorn

Joined: Dec 09, 2011
Posts: 5
Can you please explain how to do this through an example!

Thank You!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

The "value=" of a dataTable should NOT be a method call or reference to a simple collection object. It should reference a backing bean property whose "get" method returns a JSF DataModel object.

The JSF DataModel interface is implemented by several different stock JSF classes, although the one I use most often is the ListDataModel. It wraps a Java List and provides the cursor services needed for JSF to be able to tell which row of the table you are interacting with.

One important thing to know about dataTables and DataModels. A class containing a DataModel has to be of at least View scope (Session scope, if JSF1.x). Request scope won't work, because the original DataModel object is destroyed and re-created, losing the cursor position.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataTable datas are not actual