2013-02-11 32 views
0

以下代碼包含兩個選項卡和來自showcase示例的基本代碼。我試圖把這個代碼放到一個xhtml中,並且做了ui:包含在標籤中,並且在下面的列表中添加它們。無論哪種方式,當我點擊提交按鈕,沒有看到任何顯示的結果。PrimeFaces TabView在提交時未顯示結果

在此先感謝

<?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> 
+0

顯示您的支持bean代碼。 – partlov 2013-02-11 13:46:22

+0

你知道命令按鈕什麼也沒做(沒有'action'),只是刷新視圖,不會改變,因爲'display'的值將保持與點擊按鈕之前的值相同 – kolossus 2013-02-11 14:52:09

回答

0

在PrimeFaces的使用手冊的記載,你應該避免嵌套佈局和佈局單位的內部形式,並且每個佈局單元應該有自己的形式,來代替。所以刪除表單,並在每個layoutUnit

+0

感謝您的回覆,測試了兩個選項,在LayoutUnit中添加了表單,並且還刪除了LayoutUnit和Layout,取而代之的是在每個表單中放置了一個panelgrid。仍然沒有結果顯示。 – 2013-02-11 12:08:37