What your asking is a little complicated if you are populating the page
as a list from the database.
You need to know how to transfer that result-set information to a property reference each.
E.G. a cheap trick would be first getting a query such as mysql
select count(distinct) where....
then collecting the same but the required identity information to send to each property of an array
governed by the
previous distinct count.
The get method each time it is referred to by page call will trigger a bean internal method to ++ increment and retrieve each array value and a final special page call at the end of the page(another method) could reset the counter value to zero for next use.
usersNameOut would contain that ++ system, but your difficulty is matching page code(markup) output iterations.
first: declare your pages with the @ directive at the pagetop
threadsafe="false"
second: with you JSF
session bean, for the user (provided your not using JAAS)
<h:commandLink id="johnsmith"
action="detailspage"
actionListener="#{sessionBean.makePageChangeLtsn}">
<h:outputText value="#{sessionBean.usersNameOut}" />
</h:commandLink>
name of the beans [i]actionListener method in your session bean:
makePageChangeLtsn[/i]
bean call inside faces-config.xml navigation rule
#{sessionBean.pageChangTo}
The actionlistener method you write must return( alike setWhereTo(
String where) ) to the property(String where; // global) that holds the navigation value property configured in navigation by the rules in faces-config.xml
When the render
phase(response) occurs the bean method that calls get on the where property must be set as the outcome in the navigation rule.
name of the method returning a List of usersDetails: usersDetails
You can take the hyperlinks out and replace with a commandbutton in a form that points to an outcome PAGE in your faces-config.xml navigation.
Either way it requires iteration over values from somewhere and storing individual forms for each set of details unique identifier information.
So you would see something like:
|| Jonh Smith || =buttonDETAILS= ||
|| Alison Jones || =buttonDETAILS= ||
....
inside the page this would look like where the button is (.faces or what your configured trigger is):
<form id="johnsmith" method="post" action="/applicationname/yourpage.faces">
<h:inputHidden name="SOMEPREFIX:name" id="SOMEPREFIX:name" value="Alison Jones" />
<h:commandButton id="SOMEPREFIX:submit" action="detailspage" value="Get Details" />
</form>
== table-row and table-data here == then
<form id="AlisonJones" method="post" action="/applicationname/yourpage.faces">
<h:inputHidden name="SOMEPREFIX:name" id="SOMEPREFIX:name" value="Alison Jones" />
<h:commandButton id="SOMEPREFIX:submit" action="detailspage" value="Get Details" />
</form>
in the detailspage use the
value to query your database, you supply to that value what you need