• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Identifying Selected Row in Table

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am fairly new to JSF, and I am struggling with identifying which table row I have selected out of the Woodstock Basic Table component in NetBeans 6.1.

I have an EJB that returns a list that I successfully display in my table component. Each row has a Hyperlink component (or in some cases a Button component). When I click the Hyperlink or Button, I need to identify which row this was from in order to correctly display the related data on the next page.

I would think this would be a fairly standard requirement, but I am having problems. Any help would be appreciated.
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bind the table component with an UIData property in the backing bean and use UIData#getRowData() in the action method.
 
Trey Brown
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I gave this a try and am still having difficulty. When I bind to the UIData property, I end up with a blank screen instead of data. I should note that I am using the Visual JSF Table Component, so maybe this is making a difference?

Here is a snippet from the JSF:

<webuijsf:table augmentTitle="false" binding="#{NameList.uiNames}" id="tblNames" title="Table" width="672">

<webuijsf:tableRowGroup id="tableRowGroup1" rows="10" sourceData="#{NameList.nameListEJB}" sourceVar="currentRow">

The associated java:

private UIData uiNames = new UIData();
public UIData getUiNames()
{
return uiNames ;
}

public void setUiNames(UIData uiNames )
{
this.uiNames = uiNames ;
}
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't create the component yourself. Otherwise that instance would be used rather than the one already declared in the JSF page.
 
Come have lunch with me Arthur. Adventure will follow. This tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic