2
我有一个动态创建的HtmlCommandLink
与ActionListener
,但是当我点击链接时,动作侦听器方法没有被调用。动态创建的HtmlCommandLink上没有调用ActionListener
代码:
public HtmlPanelGroup getP() {
p = new HtmlPanelGroup();
FacesContext ctx = FacesContext.getCurrentInstance();
HtmlCommandLink l = new HtmlCommandLink();
l.setTitle("Goto");
l.setImmediate(true);
l.addActionListener(new ComponenetListener());
//new ListenerTest());//new MethodExpressionActionListener(methodExpression));
l.setValue("Go");
p.getChildren().add(l);
return p;
}
和监听代码
@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.");
}
}
感谢您的回复或有任何更改要求 –
非常感谢您的回复工作 –