Search code examples
ajaxwebspherejsf-2.2

Ajax event not being invoked


One of the pages from my application has a selectOneMenu component with an Ajax event that does not get triggered. I've similar pages, with similar components, that work as expected. One example that works:

<h:selectOneMenu value="#{debugParam.debugLevelBusiness}"
    id="debugLevelBusiness" 
    rendered="#{not (debugParam.debugLevelBusiness eq 'DEPEN')}"
    styleClass="form-control #{debugParam.debugLevelBusiness}">
    <f:selectItems value="#{manager.logLevels}"  />
    <f:ajax execute="@this" listener="#{loggingBean.businessValueChangeListener(debugParam)}" />
</h:selectOneMenu>

Generates the following element:

<select id="transactionalParameters:0:debugLevelBusiness" name="transactionalParameters:0:debugLevelBusiness" class="form-control DEBUG" size="1"
onchange="mojarra.ab(this,event,'valueChange','@this',0)">   
                <option value="OFF">OFF</option>
                <option value="ERROR">ERROR</option>
                <option value="WARN">WARN</option>
                <option value="INFO">INFO</option>
                <option value="DEBUG" selected="selected">DEBUG</option>
</select>

The component that doesn't work:

<h:selectOneMenu value="#{parameter.epmsEventsLogState}"    
    id="epmsEventsLogState" 
    styleClass="form-control #{parameter.epmsEventsLogState}">
    <f:selectItem itemLabel="#{labels.enabled}" itemValue="E" />
    <f:selectItem itemLabel="#{labels.disabled}" itemValue="D" />
    <f:ajax execute="@this" listener="#{eventsLogBean.valueChangeListener(parameter)}" />
</h:selectOneMenu>

Generates the following element:

<select id="parameters:19:epmsEventsLogState" name="parameters:19:epmsEventsLogState" size="1"
    onchange="jsf.ajax.request('parameters:19:epmsEventsLogState',event,{execute:'@this ','javax.faces.behavior.event':'valueChange'})" class="form-control E">               
           <option value="E" selected="selected">Ativo</option>              
           <option value="D">Inativo</option>
</select>

Notice the difference on the generated javascript on both elements. This is only causing an issue on WebSphere 9, it works well on GlassFish and WildFly. Does anyone known what might be causing the issue?


Solution

  • I apologize for answering my own question, but I've finally figured out what was the problem. The <h:form> element was inside a <tbody> element and WebSphere was misplacing the generated element, making all inputs to be outside the form. Moving the <h:form> to outside the <table> solved the problem.