我有一個名爲添加面板的添加面板的按鈕需要顯示,並且面板內有一個取消按鈕onclick取消面板應該關閉我的問題是點擊添加按鈕面板來一會兒消失。實際上,我已經incuded template_2.xhtml其中..如果我從template_2.xhtml面板工作正常,但這些警告即將到來這樣的形式組件需要有一個UIForm在其祖先。建議:附上必要的組件中的兩個我都想要的東西,做工精細,並警告不應該來。這裏是我的代碼i know the problem that i am using 2 times form in 1 xhtml page but not able to overcome that help me out
`點擊jsf/primefaces中的按鈕啓用/禁用面板?
<h:commandButton value="Add" id="show" action="#" onclick="panelwv.show()" ></h:commandButton>
<h:form>
<p:panel id="panel" widgetVar="panelwv" visible="false" header="Add Dependents">
<h:panelGrid id="myPanel" columns="3" cellpadding="5" styleClass="text-input">
<h:outputText value=""/>
<h:outputLabel value="Name" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<h:inputText id="name" value="#{depco.depapp.dep.name}" styleClass="border" label="First Name" />
<h:outputText value=""/>
<h:outputLabel value="Relationship" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<h:inputText id="rel" value="#{depco.depapp.dep.relationship}" styleClass="border" label="Relationship" />
<h:outputText value=""/>
<h:outputLabel value="Date of Birth" style="font-family: cursive;font-size: 18px;font-weight:normal;"/>
<p:calendar id="dob" value="#{depco.depapp.dep.dob}" showOn="button" label="Date of Birth" />
<h:outputText value=""/>
<h:outputLabel value="Emp Id" />
<h:selectOneMenu value="#{depco.depapp.dep.empId}" >
<f:selectItems value="#{coemp.empapp.itemsAvailableSelectOne}" var="emp" itemLabel="#{emp.empId}" itemValue="#{emp.empId}" />
<f:converter converterId="employeeConverter" />
</h:selectOneMenu>
<h:outputText value=""/>
<h:commandButton value="Save" action="#{depco.createDepAction()}"/>
<h:commandButton action="#" id="hide" onclick="panelwv.hide()" value="cancel"/>
</h:panelGrid>
</p:panel>
</h:form>
`
在實際JSF頁面的xyz.xhtml:我已經包括jsf頁面調用template_2.xhtml,如果我包括 ... 內 .... 這個錯誤來了,面板越來越顯示。我嘗試使用p:commandButton同樣的問題出現,你能幫助我與例 –
user3227175