2015-11-16 23 views
-2

在我的web應用程序中,我必須展示豐富的工具提示,這意味着工具提示有時會格式化一些文本,甚至包含圖像或表格。如何使工具提示使用Primefaces 5.x顯示靜態頁面片段?

我計劃將工具提示的內容放在.xhtml文件中,因此在需要時重新格式化它們會更容易。

但是,我找不到任何示例或代碼示例顯示此行爲。我想我必須合併某些組件才能達到我想要的效果,但無法弄清楚。

這可能嗎?怎麼樣?

+0

所以,你不只是簽出陳列櫃或指導用戶如果PrimeFaces有一個工具提示組件? – BalusC

+0

我知道這樣的組件存在,但在展示櫃中沒有任何符合我需求的示例。就像,有一些工具提示的例子,但簡單和簡短的文字,不是我需要的豐富,而不是從外部文檔。無論如何,我知道我的問題可以寫得更好,以避免像你的解釋。我的錯! – AlexSC

回答

1

請您在下次需要閱讀質量問題之前閱讀Primefaces文檔。這很容易。

<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://xmlns.jcp.org/jsf/facelets" 
    xmlns:p="http://primefaces.org/ui"> 
<h:head> 
</h:head> 
<h:body> 
    <h:form id="mainForm"> 
     <h:outputText value="I must to look at Primefaces Showcase: " /> 
     <h:outputLink id="content" value="#"> 
      <h:outputText value="Primefaces" /> 
     </h:outputLink> 
     <p:tooltip id="toolTipContent" for="content"> 
      <ui:include src="include.xhtml" /> 
     </p:tooltip> 
    </h:form> 
</h:body> 
</html> 

include.xhtml

<ui:composition 
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:f="http://xmlns.jcp.org/jsf/core" 
    xmlns:h="http://xmlns.jcp.org/jsf/html" 
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> 
    <h2>Include tooltip</h2> 
    <h:graphicImage value="http://www.primefaces.org/showcase/javax.faces.resource/main/images/logoBlue.svg.xhtml" /> 
</ui:composition> 
+0

正如我對BalusC所說的,我確實在挖掘Primefaces展示,但現有的示例並未解決我的特殊需求(來自外部文件的豐富文本)。在編寫問題細節時,我的確可以更加小心,以避免我沒有花費時間在這裏的想法。無論如何,在這種情況下我看不到使用(這在樣本中沒有),爲此我感謝您分享您的知識! – AlexSC

相關問題