簡體   English   中英

PrimeFaces TabView提交時不顯示結果

[英]PrimeFaces TabView no results displayed on submit

以下代碼包含兩個標簽和展示示例中的基本代碼。 我試圖將這段代碼放入xhtml中,並在選項卡中執行了ui:include,還只是將它們添加到了選項卡中,如下所示。 無論哪種方式,當我單擊“提交”按鈕時,都看不到顯示的任何結果。

提前致謝

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

 <h:form> 
 <p:tabView id="tabs" orientation="left" styleClass=".borderlessUnit" dynamic="true">
    <p:tab id="tab0" title="Test Menu 1">
       <p:layout id="layout0" style="min-height:600px;">
          <p:layoutUnit position="center" resizable="true" styleClass="borderlessUnit">
                <h:outputLabel for="name" value="Name 1:" style="font-weight:bold"/>  
                <p:inputText id="name" value="#{personBean.firstname}" />  
                <p:commandButton value="Submit" update="display"/>  
                <h:outputText value="#{personBean.firstname}" id="display" />  
          </p:layoutUnit>                            
       </p:layout>   
     </p:tab>
     <p:tab id="tab1" title="Test Menu 2">
       <p:layout id="layout1" style="min-height:600px;">
         <p:layoutUnit position="center" resizable="true" styleClass="borderlessUnit">
                <h:outputLabel for="name1" value="Name 2:" style="font-weight:bold"/>  
                <p:inputText id="name1" value="#{personBean.secondname}" />  
                <p:commandButton value="Submit1" update="display1"/>  
                <h:outputText value="#{personBean.secondname}" id="display1" />  
         </p:layoutUnit>
       </p:layout>
      </p:tab>    
</p:tabView>
</h:form>
</html>

PrimeFaces在使用手冊中記錄了您應避免在表單內嵌套布局和布局單元,而每個布局單元應具有自己的表單。 因此,刪除表單,並將分離的表單放入每個layoutUnit

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM