Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display the content of a variable without <h:outputText>?

 
Fabian Angy
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

At this moment, I use <h: outputText value="#{bean.informations}", in this variable I have some HTML code with all informations to display. But now, I need to include some <rich:tooltip>" but if I put in my variable "<rich:tooltip ...>" with <h: outputText> it doesn't work.

There is another way to display that without outputText? (is it simply possible?)

I display my informations like this:


My "informations" contains:


And I would like to display



Thanks in advance!
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17995
47
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tooltips are intended to provide hints on how to use input controls. That's why they don't work on outputText. You can, however, attach a CSS hover pop-up to the outputText the same way you with with straight HTML.

Speaking of straight HTML, I don't recommend mixing raw HTML and JSF. However, in the case of "span" tags around outputText, it's not merely not recommended, it's actually redundant. The outputText HTML renderer places span around the text so that it will have a place to put the style/styleClass values that were coded on the outputText tag.
 
Fabian Angy
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, I need to use rich:tooltip because my informations comes from webservices, in waiting the retrieving of informations, i need to have a message (by example "webservice is calling") and when the webservice returns the information, the value of the tooltip have to change. So, I can't do that with a simple CSS.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17995
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fabian Angy wrote:In fact, I need to use rich:tooltip because my informations comes from webservices, in waiting the retrieving of informations, i need to have a message (by example "webservice is calling") and when the webservice returns the information, the value of the tooltip have to change. So, I can't do that with a simple CSS.


Actually, you can. Put the text in a floating div element and use JavaScript to populate it with the text from the web service. Then attach "hover" javascript to the outputText element that positions the div and makes it visible/invisible. It's not that uncommon.

However, for best results, "tooltip" isn't a good search term, since a tooltip is - like I said - literally a tip on how to use an (input) tool (control). You'll probably get better results searching for "hover text".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic