I'm displaying a tooltip to display me more information about something. I was using this approach:
<tooltip:tip value="${it.something}>
It turns out that, 'it.something' is not enought, and i need to, as well, display 'it.something2' and 'it.something3'. I did the following, but it is not working:
<tooltip:tip value="<% out << '<b> Title: <b> ${it3.prog_title} <br> <b> Start at: <b> ${it3.prog_start} <br><b> End at: <b> ${it3.prog_end} <br><b> Description: <b> ${it3.prog_description} <br>' %>" stylesheet="myTooltipStyles">
ERROR: Exception Message: Tag [tooltip:tip] is missing required attribute [code] or [value]
I would also want to know, how can i make a stylesheet for my tooltip, how can i access in in css?
What you're doing here is in every way fighting what using a TagLib
is supposed to help you accomplish. Your TooltipTagLib
should be taking care of all of the markup responsibility and should accept only the attributes it needs to insert into the markup, rather than another string full of markup.
If you rework your tag library, you can probably avoid the strange errors you're getting. Your tip
tag closure ought to look something like this (crude) example:
def tip = { attrs ->
out << "<b>Title:</b> ${attrs.title}<br/>"
out << "<b>Start at:</b> ${attrs.start}<br/>"
out << "<b>End at:</b> ${attrs.end}<br/>"
out << "<b>Description:</b> ${attrs.description}<br/>"
}
And you would call it like:
<tooltip:tip title="${it3.prog_title}"
start="${it3.prog_start}"
end="${it3.prog_end}"
description="${it3.description}"/>
Try rethinking how you use your tag library and you'll find that you won't encounter strange errors like this.