【问题标题】:PrimeFaces TabView no results displayed on submitPrimeFaces TabView 提交时不显示结果
【发布时间】:2013-02-11 10:19:58
【问题描述】:

以下代码包含来自展示示例的两个选项卡和基本代码。我尝试将此代码放入 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>

【问题讨论】:

  • 向我们展示您的支持 bean 代码。
  • 您知道命令按钮什么都不做(没有action)只是刷新视图,这不会改变,因为display 的值将保持与按钮之前相同被点击了

标签: jsf primefaces submit tabview


【解决方案1】:

PrimeFaces 的使用手册记录了您应该避免在表单中嵌套布局和布局单元,并且每个布局单元都应该有自己的表单。所以删除表格,并将单独的表格放在每个layoutUnit

【讨论】:

  • 感谢您的回复,测试了两个选项,在 LayoutUnit 中添加了表单并删除了 LayoutUnit 和 Layout,而是在每个表单中提供了一个 panelgrid。仍然没有显示结果。
猜你喜欢
  • 2016-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-27
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多