In an application that based on J2EE 1.4, an issue has been found with the setPages call of bread crumbs which prevents the action handler from being called. To workaround this issue, you need to replace the setPages call with folderCrumbs.getChildren().add(hyperTmp) to add the hyperlink as a child of the Breadcrumbs. This will make the action handler to get invoked.
Hyperlink[] crumbsTest = new Hyperlink[5];
for (int i = 0; i < 5; i++) {
Hyperlink hyperTmp = new Hyperlink();
hyperTmp.setText("Link " + i);
hyperTmp.setToolTip("Link " + i + " tooltip");
//create the methodbind
MethodBinding mb = (MethodBinding) this.getApplication().createMethodBinding("#{Page1.breadcrumbLinkTest_action}", null);
hyperTmp.setAction(mb);
crumbsTest[i] = hyperTmp;
folderCrumbs.getChildren().add(hyperTmp);
}
If your application is based on Java EE 5, you can use setPages. Please note the way to define method binding is different.
Hyperlink[] crumbsTest = new Hyperlink[5];
for (int i = 0; i < 5; i++) {
Hyperlink hyperTmp = new Hyperlink();
hyperTmp.setText("Link " + i);
hyperTmp.setToolTip("Link " + i + " tooltip");
// Create method expression
MethodExpression me = (MethodExpression)this.getApplication().getExpressionFactory().createMethodExpression(
getFacesContext().getELContext(), "#{Page1.breadcrumbLinkTest_action}", String.class,new Class[] {});
hyperTmp.setActionExpression(me);
crumbsTest[i] = hyperTmp;
}
breadcrumbs1.setPages(crumbsTest);