JSF 表单不执行操作,因为组合框

发布于 2024-09-17 17:39:28 字数 7642 浏览 9 评论 0原文

执行此表单时,不会执行该操作。但是,如果我注释组合框的代码,则执行操作不会出现任何问题。所以我认为我的 spring webflow 没问题。
组合框填充了正确的数据,没有任何问题,所以我假设问题出在 jsf 模板中?

代码:

<%@ 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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

甚是思念 2024-09-24 17:39:28

添加到页面以获取任何验证/转换错误的通知。您很有可能会在那里看到“验证错误:值无效”。如果确实如此,那么您需要重写您的支持 bean 代码,以确保所有 标记的 getter 在表单提交请求期间返回完全相同的列表在初始表单显示请求期间。

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.

昔日梦未散 2024-09-24 17:39:28

解决了。这是一个 JSF 问题,因为从组合中没有获得由支持 bean 填充的正确类型的数据。我无法从中得到任何东西,因为在我们的“框架”中,我们覆盖了该功能以显示自定义消息。 BalusC 你说得对。谢谢

Solved. It was a JSF problem, because from the combos didn't get the right type of data, populated by the backing bean. And I couldn't get anything from because in our 'framework' we had that feature overridden to display customized messages. BalusC you were right in the points. Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文