javajsfmyfacestomahawk

JSF form not executing action because comboboxes


When executing this form, the action is not executed. But if I comment the code for the comboboxes the action is executed without any problem. So I assume my spring webflow is ok.
The comboboxes are populated with the right data without any problem so I am assuming the problem is in the jsf template?

Code:

<%@ include file="/jsp/taglibs.jsp"%>
<t:saveState value="#{traballadorManageBean.traballador.cargoTraballador.idCargoTraballador}"/>
<t:saveState value="#{traballadorManageBean.traballador.tipoPerfil.idTipoPerfil}"/>
<t:saveState value="#{traballadorManageBean.traballador.centro.idCentro}"/>
<t:saveState value="#{traballadorManageBean.traballador.nome}"/>
<t:saveState value="#{traballadorManageBean.traballador.apelido1}"/>
<t:saveState value="#{traballadorManageBean.traballador.apelido2}"/>
<t:saveState value="#{traballadorManageBean.traballador.usuario}"/>
<t:saveState value="#{traballadorManageBean.traballador.contrasinal}"/>
<t:saveState value="#{traballadorManageBean.traballador.email}"/>

<t:messages/>
<t:panelGrid id="insertarTraballador" width="100%">

    <f:verbatim>
        <br />
    </f:verbatim>
    <t:outputText value="#{msg.ins_traballador_datos}" styleClass="bigTitle"/>
    <t:panelGrid id="datosTraballador" align="right" width="100%"
        styleClass="tablaBorde" cellpadding="2" cellspacing="2" columns="4">

        <t:panelGroup>
            <t:outputText value="#{msg.ins_traballador_cargo_traballador}" />
        </t:panelGroup>
        <t:panelGroup>
            <t:selectOneMenu id="comboCargosTraballador" 
                value="#{traballadorManageBean.traballador.cargoTraballador.idCargoTraballador}" tabindex="1">   
                <f:selectItem itemLabel="--------------------------------" itemValue="-1" />
                <f:selectItems value="#{traballadorManageBean.listaCargosTraballador}" />       
            </t:selectOneMenu>
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />        
            <t:outputText value="#{msg.ins_traballador_tipo_perfil}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:selectOneMenu id="comboTiposPerfil" 
                value="#{traballadorManageBean.traballador.tipoPerfil.idTipoPerfil}" tabindex="2">   
                <f:selectItem itemLabel="--------------------------------" itemValue="-1" />
                <f:selectItems value="#{traballadorManageBean.listaTiposPerfil}" />         
            </t:selectOneMenu>
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />        
            <t:outputText value="#{msg.ins_traballador_centro_traballo}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:selectOneMenu id="comboCentroReceptor" 
                value="#{traballadorManageBean.traballador.centro.idCentro}" tabindex="3">   
                <f:selectItem itemLabel="--------------------------------" itemValue="-1" />
                <f:selectItems value="#{traballadorManageBean.listaCentros}" />             
            </t:selectOneMenu>
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />    
            <t:outputText value="#{msg.ins_traballador_usuario}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtUsuario" tabindex="4" value="#{traballadorManageBean.traballador.usuario}" size="30" />
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />    
            <t:outputText value="#{msg.ins_traballador_contrasinal}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtContrasinal" tabindex="5" value="#{traballadorManageBean.traballador.contrasinal}" size="30" />
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="#{msg.ins_traballador_email}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtEmail" tabindex="6" value="#{traballadorManageBean.traballador.email}" size="60" />
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />        
            <t:outputText value="#{msg.ins_traballador_nome}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtNome" tabindex="7" value="#{traballadorManageBean.traballador.nome}" size="40" />
        </t:panelGroup>

        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>     
        <t:panelGroup>
            <f:verbatim><br/></f:verbatim>
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="*" styleClass="campoObligatorio" />        
            <t:outputText value="#{msg.ins_traballador_apelido1}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtApelido1" tabindex="8" value="#{traballadorManageBean.traballador.apelido1}" size="40" />
        </t:panelGroup>

        <t:panelGroup>
            <t:outputText value="#{msg.ins_traballador_apelido2}" />
        </t:panelGroup>     
        <t:panelGroup>
            <t:inputText id="txtApelido2" tabindex="9" value="#{traballadorManageBean.traballador.apelido2}" size="40" />
        </t:panelGroup>
    </t:panelGrid>


    <t:panelGrid id="botonera" align="center" >
        <t:commandButton id="botonGuardar" tabindex="1000"
            styleClass="button"
            type="submit" 
            value="#{msg.ins_traballador_boton_crear}"
            action="insertar"></t:commandButton>
    </t:panelGrid>      
</t:panelGrid>

Solution

  • Add <h:messages/> to the page to get notified of any validation/conversion errors. Big chance that you see "Validation error: value not valid" in there. If this is indeed the case, then you need to rewrite your backing bean code to ensure that the getter for all <f:selectItems> tags returns exactly the same list during the form submit request as it did during the initial form display request.