0

I have a jsf 2.2 application (myfaces 2.2.8). On a page I have multiple forms from different included (jsf:include) facelet files.

In one file a form is defined with a <f:event type="postValidate"...> tag. In another included file another form is defined with only a submit button.

Clicking on this button triggers the listener defined in f:event. Why?

Bohuslav Burghardt
  • 33,626
  • 7
  • 114
  • 109

1 Answers1

1

The f:event tag isn't bound to any of the forms. It's just a tag to tell JSF to invoke a listener if an event of the declared type happens, no matter where in the view. So it's the expected behaviour to be invoked when any of the forms is submitted. You could anyway grab the source form into the listener:

public void listener(ComponentSystemEvent evt) {
    //Get the source form
    evt.getSource();
}

See also:

Community
  • 1
  • 1
Aritz
  • 30,971
  • 16
  • 136
  • 217