java Multiple h:视图中的表单不工作
我有一个p:selectOneMenu组件,可以通过以下方式更新另一个组件:
<h:form id="formaComboInstrumento">
<p:selectOneMenu value="#{CDat.instrumentoSeleccionado}">
<f:selectItem itemValue="" itemLabel="--Selecciona un examen--"/>
<f:selectItems value="#{CDat.mapaInstrumentos.entrySet()}" var="var" itemValue="#{var.key}" itemLabel="#{var.value}" />
<p:ajax listener="#{CDat.cambioComboInstrumento}" update=":subtipo"/>
</p:selectOneMenu>
</h:form>
<p:selectOneMenu id="subtipo" value="#{CDat.mapaInstrumentosSubtipo}" >
<f:selectItem itemValue="" itemLabel="--Selecciona un examen--"/>
<f:selectItems value="#{CDat.mapaInstrumentosSubtipo.entrySet()}" var="var" itemValue="#{var.key}" itemLabel="#{var.value}" />
</p:selectOneMenu>
这很好用。然后稍微向下一点,我有另一个带有p:commandButton的表单用于提交/处理,这样:
<h:form id="formaProcesarAplicacion">
<p:growl id="growl3" sticky="false" life="3000"/>
<p:commandButton value="Procesar aplicacion" action="#{CDat.procesarAplicacion}" update="growl3"/>
</h:form>
不幸的是,最后一个表单从未触及bean(我知道,因为当我删除第一个表单时,方法/操作过程将进行处理并显示值),这使得数据处理变得不可能
有什么想法和建议吗
我使用的是primefaces 3.5、mojarra 2.1.22、tomcat 7和Eclipse Juno
# 1 楼答案
根据评论,您的问题与未封装在
<h:form />
中的<p:selectOneMenu id="subtipo" />
有关既然您这么做了,这个菜单值就永远不会发布到bean中。可能是因为您遇到了一个验证或处理错误,阻止了
p:commandButton
操作