【发布时间】:2015-03-02 10:07:47
【问题描述】:
我正在使用 JDK1.7、JSF2 和 Primefaces。
我有一个.xhtml,如下所示。我想列出Parent and the Child Relations 如下<Component Id Tree Structure> | <Id> | <Child of Id- Parent> 如Expected Output 所示
xhtml:
<h:form id="rootParentForm">
<p:treeTable id="singleTreeTble" value="#{ttSelectionView.root1}" var="document" selectionMode="single" selection="#{ttSelectionView.selectedNode}" style="margin-top:0">
<f:facet name="header">
Single
</f:facet>
<p:column headerText="Name">
<h:outputText value="#{document.name}" />
</p:column>
<p:column headerText="Size">
<h:outputText value="#{document.size}" />
</p:column>
<p:column headerText="Type">
<h:outputText value="#{document.type}" />
</p:column>
</p:treeTable>
<p:commandButton id="singleCmdBtn" value="Display" update="msgs" icon="ui-icon-newwin"
actionListener="#{ttSelectionView.displaySelectedSingle}"/>
<h3 style="margin-top:0">Basic</h3>
<p:accordionPanel id="basicAP">
<p:tab id="basicTab1" title="Godfather Part I">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather1.jpg" />
<h:outputText
value="The story begins as Don Vito Corleone..." />
</h:panelGrid>
</p:tab>
<p:tab id="basicTab2" title="Godfather Part II">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather2.jpg" />
<h:outputText value="Francis Ford Coppola's legendary..." />
</h:panelGrid>
</p:tab>
<p:tab id="basicTab3" title="Godfather Part III">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather3.jpg" />
<h:outputText value="After a break of more than 15 years..." />
</h:panelGrid>
</p:tab>
</p:accordionPanel>
<h3>Multiple Selection</h3>
<p:accordionPanel id="multipleAP" multiple="true">
<p:tab id="multipleTab1" title="Godfather Part I">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather1.jpg" />
<h:outputText
value="The story begins as Don Vito Corleone..." />
</h:panelGrid>
</p:tab>
<p:tab id="multipleTab2" title="Godfather Part II">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather2.jpg" />
<h:outputText value="Francis Ford Coppola's legendary..." />
</h:panelGrid>
</p:tab>
<p:tab id="multipleTab3" title="Godfather Part III">
<h:panelGrid columns="2" cellpadding="10">
<p:graphicImage name="demo/images/godfather/godfather3.jpg" />
<h:outputText value="After a break of more than 15 years...." />
</h:panelGrid>
</p:tab>
</p:accordionPanel>
</h:form>
预期输出:
执行此操作的最佳方法是什么?因此,所有的父子关系都将按预期列出。
我将上传 xhtml 页面,然后我想查找并显示父子关系。
【问题讨论】:
-
这些话是什么意思:“我将上传 xhtml 页面,然后我想查找并显示父子关系”?您想在上传一些 Facelets 文件后构建和分析组件树而不重新部署应用程序吗?这个上传的 xhtml 应该与正在运行的应用程序相关还是只是任何“真空中的球形 Facelets 文件”?
-
@iTollu 我的意思是有一个文件上传页面,就像它在ShowCase 中一样,一旦成功上传,我想将父子关系显示到文件中
-
然后您可以将上传的文件视为现有上下文的一部分(所有表达式都将被解析)或完全独立的代码。在你的情况下哪一个是正确的?
-
@iTollu 在我的情况下,上传的文件是现有上下文的一部分。
标签: jsf jsf-2 components tree-traversal