Jsf 2 未对动态创建的HtmlCommandLink调用ActionListener

Jsf 2 未对动态创建的HtmlCommandLink调用ActionListener,jsf-2,Jsf 2,我有一个动态创建的HtmlCommandLink和一个ActionListener,但是当我点击链接时,没有调用action listener方法 代码: 侦听器代码是 @ManagedBean @SessionScoped public class ComponenetListener implements ActionListener{ public ComponenetListener() { String s="sridhar";

我有一个动态创建的
HtmlCommandLink
和一个
ActionListener
,但是当我点击链接时,没有调用action listener方法

代码:

侦听器代码是

  @ManagedBean
  @SessionScoped
  public class ComponenetListener implements ActionListener{

       public ComponenetListener() {
          String s="sridhar";
           }

     @Override
     public void processAction(ActionEvent event) throws AbortProcessingException {
         UIComponent eventComponent = event.getComponent();
         System.out.println("test");
         String strEventCompID = eventComponent.getId();
         throw new UnsupportedOperationException("Not supported yet.");
       }
   }

您必须为所有动态创建的输入和命令组件提供一个固定ID

l.setId("yourID");
您还需要确保有一个
(或
UIForm
)组件作为树父级存在

l.setId("yourID");