This content has been marked as final. 
    
Show                 2 replies
    
- 
        1. Re: Binding HtmlCommandLink to backing bean method programmatcavaleiro Jul 22, 2007 12:19 PM (in response to rvaneperen)Hi there, 
 maybe you solved it already, but here it goes.
 Try the addActionListener.. I think it works the same way AWT-Listeners.
 import javax.faces.event.ActionEvent;
 import javax.faces.event.ActionListener;
 ...
 validateLink.addActionListener(new ActionListener() {
 public void processAction(ActionEvent evt) {
 // do something
 }
 });
- 
        2. Re: Binding HtmlCommandLink to backing bean method programmarvaneperen Aug 1, 2007 12:38 AM (in response to rvaneperen)Thanks for the reply. I ended up creating the following utility method, which works fine: public static HtmlCommandLink buildCommandLink(final String pId, final String pExpression, final String pTitle, final String pValue, final boolean pImmediate, final boolean pRendered) { ExpressionFactory factory = ExpressionFactory.newInstance(); MethodExpression expression = factory.createMethodExpression(FacesContext.getCurrentInstance().getELContext(), "#{" + pExpression + "}", String.class, new Class[0]); HtmlCommandLink link = new HtmlCommandLink(); link.setId(pId); link.setRendered(pRendered); link.setImmediate(pImmediate); link.setTitle(pTitle); link.setValue(pValue); link.setActionExpression(expression); return link; }
 
    