my dog learned polymorphism*
The moose likes JSF and the fly likes Can not Invoke actionLister - DataTable of Links Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Can not Invoke actionLister - DataTable of Links" Watch "Can not Invoke actionLister - DataTable of Links" New topic

Can not Invoke actionLister - DataTable of Links

Mike Dingham

Joined: Oct 06, 2006
Posts: 8
I have a JSP page with <h:dataTable> with value as an "array of objects".
Each row of this table is defined with commandLink with defined action/actionListener method in the managed bean.

The problem is sometimes this this action is invoked and some times it
is not. Depending on how I instantiate my "array of objects" in the managedbean.

I am populating this array of objects in constructor of managed bean
by calling a service layer method. In this case JSF does not trigger
action when I click on the link. But if I create using
new Object() and add to the array (With out calling service method
some hardcoded values) it does invoke the actionListener and it behaves
exactly how I expect it should work.

I have no clue why it does not invoke in the first case?

I am using RAD6.0, IBM JSF implementation.



public class LenderGroupsBean extends PageCodeBase

//Form data
private ILenderGroupService lenderGroupService;

private LenderGroup[] lenderGroups;

private LenderGroup selectedLenderGroup;

//Binding UIComponent Instances
private HtmlDataTable lenderGroupTable;

* Constructor()
public LenderGroupsBean()
lenderGroupService = (ILenderGroupService) beanFactory

lenderGroups = lenderGroupService.getLenderGroups();

// lenderGroups = new LenderGroup[3];
// LenderGroup lg = new LenderGroup();
// lg.setName("bb");
// lenderGroups[0] = lg;
// lg = new LenderGroup();
// lg.setName("aa");
// lenderGroups[1] = lg;
// lg = new LenderGroup();
// lg.setName("cc");
// lenderGroups[2] = lg;


* @param event
public void selectLenderGroup(ActionEvent event)
LenderGroup selectedlg = (LenderGroup) lenderGroupTable.getRowData();

JSP Code:

<h:dataTable id="lgDataTable" width="750"
value="#{pc_LenderGroups.lenderGroups}" var="lenderGroup"
binding="#{pc_LenderGroups.lenderGroupTable}" border="1">
<h:column id="lgName">
<f:facet name="header">
<h:commandLink id="name" actionListener="#{pc_LenderGroups.sort}">
<hutputText styleClass="outputText" value="LenderGroup Name"
<h:commandLink styleClass="commandLink" id="link1"
<hutputText id="text2" styleClass="outputText"
[ October 06, 2006: Message edited by: Mike Dingham ]
I agree. Here's the link:
subject: Can not Invoke actionLister - DataTable of Links
Similar Threads
Foreign key field population from datatable to textbox?
Navigation not working due due SelectOneMenu object
Input row select on data table does not get called
Help on JSF Custom tag
boolean property in dataTable