JSF Primefaces selectOneMenu 组件问题
JSF Primefaces selectOneMenu component issue
Parentpage.xhtml
<h:form id="newGame" enctype="multipart/form-data">
<h:panelGroup id="newGameid">
<p:growl id="growl" sticky="true" showDetail="true" />
<p:wizard id="newGameWizard" showNavBar="true" widgetVar="gameWiz" flowListener="#{javaMB.wizardFlow}">
<p:tab id="gameTab" title="Form">
<ui:include src="/jsf/required.xhtml" />
<ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 1}">
<ui:include src="/jsf/page1.xhtml" />
</ui:fragment>
<ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 2}">
<ui:include src="/jsf/page2.xhtml" />
</ui:fragment>
</p:tab>
<p:tab title="Submit" id="certifySubmit" >
<ui:include src="/jsf/submission.xhtml" />
</p:tab>
</p:wizard>
</h:panelGroup>
</h:form>
page1.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<style>
.borderClass {
border-color: #DEEFFF;
border-width: 2px;
border-style: solid;
}
</style>
<p:panel id="information" styleClass="panelNoBorder">
<p:fieldset toggleable="true" toggleSpeed="500" legend="Information">
<p:outputLabel value="Machine Generated"/>
<p:inputText id="machinegenerated" value="#{javaMB.machinegenerated}" >
<p:selectOneMenu id="Selectpartsby" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
<f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{javaMB.partTypeList}" />
<p:ajax update="other2" process="@this" />
</p:selectOneMenu>
<p:inputText id="other2" required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}" >
</p:fieldset>
</p:panel>
</ui:composition>
page2.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<style>
.borderClass {
border-color: #DEEFFF;
border-width: 2px;
border-style: solid;
}
</style>
<p:panel id="information2" styleClass="panelNoBorder">
<p:fieldset toggleable="true" toggleSpeed="500" legend="Information">
<p:outputLabel value="Manual Entry"/>
<p:inputText id="manualentry" value="#{javaMB.manualentry}" >
<p:selectOneMenu id="Selectpartsby6" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
<f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{javaMB.partTypeList}" />
<p:ajax update="other6" process="@this" />
</p:selectOneMenu>
<p:inputText id="other6" required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}" >
</p:fieldset>
</p:panel>
</ui:composition>
两个下拉菜单具有来自相同 table
的相同值
下拉菜单 - 部分依据
用户必须select一个选项
Database
ID name
1 NES
2 SONY
3 WII
4 OTHER
如果为 'Parts By'
编辑了 select,则需要输入文本
下拉菜单,如果没有 selected 其他功能,那么输入值所需的错误就可以正常工作,
问题出在第 2 页 单击“下一步”后没有转到下一个选项卡
如果我删除第 2 页中的 selectOneMenu 组件,它会转到下一个选项卡。
我尝试使用 Chrome 开发人员工具,但找不到任何错误,
试图在 flowListener wizardflow 方法中放置一个调试指针,甚至没有命中它。
第 1 页工作正常。
有什么想法可以 fix/resolve 吗?
从行为上看似乎缺少必填字段,但由于缺少 required.xhtml 和 JavaMB 代码,我无法告诉您真正的原因。
您可以在浏览器开发人员工具中检查 ajax 是否为咆哮返回一些 message/error (因为它没有自动更新或更新,您无法直接看到)。您还必须在每次更改 javaMB.partType.partBy 值时检查必填字段是否更新。
Parentpage.xhtml
<h:form id="newGame" enctype="multipart/form-data">
<h:panelGroup id="newGameid">
<p:growl id="growl" sticky="true" showDetail="true" />
<p:wizard id="newGameWizard" showNavBar="true" widgetVar="gameWiz" flowListener="#{javaMB.wizardFlow}">
<p:tab id="gameTab" title="Form">
<ui:include src="/jsf/required.xhtml" />
<ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 1}">
<ui:include src="/jsf/page1.xhtml" />
</ui:fragment>
<ui:fragment rendered="#{javaMB.pageType.pageTypeId eq 2}">
<ui:include src="/jsf/page2.xhtml" />
</ui:fragment>
</p:tab>
<p:tab title="Submit" id="certifySubmit" >
<ui:include src="/jsf/submission.xhtml" />
</p:tab>
</p:wizard>
</h:panelGroup>
</h:form>
page1.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<style>
.borderClass {
border-color: #DEEFFF;
border-width: 2px;
border-style: solid;
}
</style>
<p:panel id="information" styleClass="panelNoBorder">
<p:fieldset toggleable="true" toggleSpeed="500" legend="Information">
<p:outputLabel value="Machine Generated"/>
<p:inputText id="machinegenerated" value="#{javaMB.machinegenerated}" >
<p:selectOneMenu id="Selectpartsby" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
<f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{javaMB.partTypeList}" />
<p:ajax update="other2" process="@this" />
</p:selectOneMenu>
<p:inputText id="other2" required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}" >
</p:fieldset>
</p:panel>
</ui:composition>
page2.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:pe="http://primefaces.org/ui/extensions"
>
<style>
.borderClass {
border-color: #DEEFFF;
border-width: 2px;
border-style: solid;
}
</style>
<p:panel id="information2" styleClass="panelNoBorder">
<p:fieldset toggleable="true" toggleSpeed="500" legend="Information">
<p:outputLabel value="Manual Entry"/>
<p:inputText id="manualentry" value="#{javaMB.manualentry}" >
<p:selectOneMenu id="Selectpartsby6" required="true" style="width:150px" value="#{javaMB.partType.partBy}">
<f:selectItem itemLabel="Parts By:" itemValue="" noSelectionOption="true" />
<f:selectItems value="#{javaMB.partTypeList}" />
<p:ajax update="other6" process="@this" />
</p:selectOneMenu>
<p:inputText id="other6" required="#{javaMB.partType.partBy eq 4}" value="#{javaMB.otherfield}" >
</p:fieldset>
</p:panel>
</ui:composition>
两个下拉菜单具有来自相同 table
的相同值下拉菜单 - 部分依据 用户必须select一个选项
Database
ID name
1 NES
2 SONY
3 WII
4 OTHER
如果为 'Parts By'
编辑了 select,则需要输入文本下拉菜单,如果没有 selected 其他功能,那么输入值所需的错误就可以正常工作,
问题出在第 2 页 单击“下一步”后没有转到下一个选项卡
如果我删除第 2 页中的 selectOneMenu 组件,它会转到下一个选项卡。
我尝试使用 Chrome 开发人员工具,但找不到任何错误,
试图在 flowListener wizardflow 方法中放置一个调试指针,甚至没有命中它。
第 1 页工作正常。
有什么想法可以 fix/resolve 吗?
从行为上看似乎缺少必填字段,但由于缺少 required.xhtml 和 JavaMB 代码,我无法告诉您真正的原因。 您可以在浏览器开发人员工具中检查 ajax 是否为咆哮返回一些 message/error (因为它没有自动更新或更新,您无法直接看到)。您还必须在每次更改 javaMB.partType.partBy 值时检查必填字段是否更新。