I want to send a request parameter, everytime a ValueChangeListener
is invoked. I've implemented it the following way, but unfortunately it doesn't work.
Here's the code so you can get the idea.
<h:selectOneMenu value="#{MyBean.code}"
valueChangeListener="#{MyBean.codeChanged}" onchange="this.form.submit()">
<f:selectItems value="#{MyBean.codeItems}" />
<f:param name="validation" value="true" />
</h:selectOneMenu>
The <f:param>
is not supported in this construct. For JSF 1.2, it's supported in <h:commandLink>
, <h:outputLink>
and <h:outputFormat>
only. Your best bet is a <f:attribute>
.
<h:selectOneMenu value="#{MyBean.code}"
valueChangeListener="#{MyBean.codeChanged}" onchange="this.form.submit()">
<f:selectItems value="#{MyBean.codeItems}" />
<f:attribute name="validation" value="true" />
</h:selectOneMenu>
with
public void codeChanged(ValueChangeEvent event) {
UIInput menu = (UIInput) event.getComponent();
boolean validation = Boolean.valueOf(component.getAttributes().get("validation"));
// ...
}