This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Can�t manage to select a row in a t:dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Can�t manage to select a row in a t:dataTable " Watch "Can�t manage to select a row in a t:dataTable " New topic

Can�t manage to select a row in a t:dataTable

Laurent Salse

Joined: Nov 07, 2004
Posts: 14
I use a tomahawk dataTable to list a collection of objects called �dmex� in dmexTable.jsp

When I select one row to edit details in the next page �dmexDetails.jsp� I systematically get the last entries of my table.

In debug mode I could find out that JSF/MyFaces iterates through the whole list instead of selecting only the entry I clicked on.

Here is my code of dmexTable.jsp where #{dmexTable} is a backingBean of dmexTable.jsp and #{dmexBean} the backingBean of dmexDetails.jsp

<h:form id="formDmexTable">

<t:dataTable id="dmexTable"
preserveDataModel="true" >

<f:facet name="header">
<hutputText value="Id" id="columnDmexId" />
<hutputText value="#{rowDmex.dmexId}" id="rowDmexId" />

<f:facet name="header">
<hutputText value="#{msgsDmex.application}" id="columnApps" />
<t:commandLink id="selectDmexApps" action="go_to_dmexDetails" immediate="true">

<hutputText value="#{rowDmex.application}"
id="rowApplication" />

<t:updateActionListener property="#{dmexBean.dmexId}"
value="#{rowDmex.dmexId}" />



� some others properties in other columns �


Herebelow the code of my RequestScope ManagedBean #{dmexTable} containing a property dmexList and a hibernate Class called �dmexManager� that gives access to the dataBase :

public class DmexTable{

private ArrayList dmexList ;
private bsa.integration.service.DmexManager dmexManager;

public ArrayList getDmexList() {

dmexList = (ArrayList) dmexManager.findPoolList(new Dmex())
return dmexList;

public void setDmexList(ArrayList dmexList) {
this.dmexList = dmexList;

SOFAR EVRYTHING WORKS FINE ; I can list my dmex in the dataTable dmexTable !

Here below is the code of my JSP view called �dmexDetails.jsp� where #{dmexBean}is still the backingBean of the view :

<h:form id="formDmexIdentification">

<t:saveState value="#{dmexBean.dmexId}" />

<h:panelGrid columns="2">
<hutputText value="id" styleClass="sorti" />
<hutputText value="#{dmexBean.dmex.dmexId}"styleClass="sorti"/>

<hutputText value="#{msgsDmex.application}" styleClass="sorti" />

<h:inputText value="#{dmexBean.dmex.application}"
size="6" styleClass="ent" required="true" id="inputApplication" />

<h:message for="inputApplication" styleClass="mess" />

Herebelow the code of my RequestScope ManagedBean #{dmexDetails} containing the �t:saveState� property dmexId and the hibernate Class �dmexManager� that gives access to the dataBase :

public class DmexBean {

private int dmexId ;

public int getDmexId() {
return dmexId;

// this is the method that JSF/MyFaces iterates through when clicking on one commandLink of the Table !!!

public void setDmexId(int _rowDmexId) {

if (_rowDmexId > 0)
dmex = getSimpleDmex(_rowDmexId);

if (dmex == null) {


private Dmex getSimpleDmex(int _id) {

dmex = (Dmex)dmexManager.findOneId(new Dmex(),_id);

return dmex;

I can�t figure out why clicking on the command Link JSF/MyFaces does not simply send back the selected dmexId !

May someone give a hint ? I have nomore Idea since my implementation seems exactly similar to the MyFace example I used ..
I agree. Here's the link:
subject: Can�t manage to select a row in a t:dataTable
Similar Threads
datatable - row colors
Input row select on data table does not get called
Unable to find setter method for attribute: newspaperColumns
Issues with facelets and saveState?
dataTable troubles