PrimeFaces TabView在提交时未显示任何结果

时间:2013-02-11 10:19:58

标签: jsf primefaces submit tabview

以下代码包含两个选项卡和展示示例中的基本代码。我试图把这个代码放到一个xhtml中并且做了ui:包含在选项卡中,并且只是在选项卡中添加它们,如下面的列表所示。无论哪种方式,当我单击提交按钮时,看不到任何显示的结果。

提前致谢

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

1 个答案:

答案 0 :(得分:0)

在使用PrimeFaces的手册中,您应该避免在表单内嵌套布局和布局单元,并且每个布局单元应该有自己的形式。因此,请删除表单,并将分隔的表单放在每个layoutUnit