I posted a similar question to this on the sun forums the other day, but the Faces group seems to have disappeared from that site. I get better answers here anyway.
I'm creating a table using dataTable displaying a List containing a number of beans. I want to create in one of the cells links to get a detail view of that row of data (the row is just a summary). This is what I'm trying:
As you can see I'm trying to populate the form with a hidden value for the row I want to generate the detail view of. What I found that there's no way to retrieve that reportId, even if you create a managed bean called report.
From a reply I got on the sun forums, it seems that I can wrap my data in a ListDataModel and do what I want to do somehow. I'm not entirely sure how to do that based on what I've read online and in Core JavaServer Faces. The other difficulty is that I'd like to do it through an action of the user bean, not the list model. The reason for this is the application has very fine grained access control and user logging (it's a healthcare application) and by focusing all actions through the user bean it gives me the control that I need.
Any thoughts on how to accomplish what I'd like to do?
Thanks much! Mike
Joined: Aug 12, 2004
OK, after remembering that my work has a Safari subscription I looked up how to do this in the O'reilly JavaServer Faces book. It was much more clear than the Sun book was. And the answer really did end up being 'wrap your data in ListDataModel and Faces does the rest'.
I had to modify my user bean to store the data model as an instance variable, then when the row detail was clicked on I could retrieve the bean representing the row that was clicked on by calling the getRowData method of the data model.
Anyway, I wanted to post my discovery in case someone else came here looking for the same solution. Thanks.