如何在tooltip
primefaces
组件上primefaces
以将第一行与第二行分开?
<p:tooltip id="toolTip" for="idButton" value="First line Second Line" position="top"/>
PrimeFaces tooltip supports the escape
attribute since 5.1, so just do
<p:tooltip id="toolTip" for="idButton" value="First line<br/> Second Line" position="top" escape="false"/>
But if you want to have a more 'visible' html, you can also do
<p:tooltip id="toolTip" for="idButton" position="top">
First line
<br/>
Second Line
</p:tooltip>
To show the tooltip with a line break you have to put it like this
<p:tooltip for="...">
<h:outputText value="First line"/>
<br/>
<h:outputText value="Second line"/>
</p:tooltip>
Or using PrimeFaces Extensions (pe:tooltip)
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:pe="http://primefaces.org/ui/extensions">
...
<pe:tooltip for="...">
<h:outputText value="First line <br/> Second line" escape="false" />
</pe:tooltip>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.