In JSF backed bean I got an IllegalStateException
when the programmatically added action listener of a programmatically added Primefaces menu item is called. I
EL (read: reflection) cannot access/construct anonymous classes. Refactor them into fullworthy classes.
So, replace
item.addActionListener(new ActionListener() {
@Override
public void processAction(ActionEvent event)
throws AbortProcessingException {
System.out.println(event.toString());
}
});
by
item.addActionListener(new FooActionListener());
and
public class FooActionListener implements ActionListener {
@Override
public void processAction(ActionEvent event)
throws AbortProcessingException {
System.out.println(event.toString());
}
}