I keep reading posts which say that ActionListener methods must have the following signiture:
public void calledByActionListener(ActionEvent e) {
}
Invoked like so:
<p:commandButton value="Example" id="example" process="@this" ajax="false"
actionListener="#{exampleBean.calledByActionListener()}">
However I have a no-arg method like this which works:
public void calledByActionListener() {
}
Did something change?
Yes, that's the new EL 2.2 feature of invoking methods with custom arguments. Basically, you're explicitly invoking an argumentless method. This construct is legit.
Note that this is not related to JSF2. EL 2.2 just happens to be part of Java EE 6 as well like JSF2. So it look like a new JSF2 feature. But it actually isn't. As evidence, JSF2 is backwards compatible with Java EE 5 which thus implies EL 2.1, but this construct doesn't work over there.
When not explicitly specifying any custom arguments in the method expression, JSF will as per the specification assume a default argument of
ActionEvent
in the actual method.