Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

Laurent Salse
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ..
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic