JSF 表单不执行操作,因为组合框
执行此表单时,不会执行该操作。但是,如果我注释组合框的代码,则执行操作不会出现任何问题。所以我认为我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将
添加到页面以获取任何验证/转换错误的通知。您很有可能会在那里看到“验证错误:值无效”。如果确实如此,那么您需要重写您的支持 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.解决了。这是一个 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