This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I've written a custom tag that is invoked like this: <custom:tag title="a title"/> And I'm trying to accomplish the following in my JSP page: <fmt:bundle base="messages"> <custom:tag title="<fmt:message key="foo.key"/>"/> </fmt:bundle> That is, I want to use a message from a resource bundle as input to my custom JSP tag. Is this at all possible (hopefully in a straightfoward way)?? Thanks, Jon
And just made my custom tag class look for a variable named "ia.title" in the pageContext.
Just be aware that that creates a strong coupling between your tag and its usage on the page, which could limit the reusability of the tag. While that's not always a bad thing, just be aware of it and make sure to use this type of technique only where appropriate.
Joined: Feb 14, 2004
Good advice! To try to keep the coupling as low as possible, I've gone ahead and made the "title" attribute a non-required attribute in the TLD, so users can do either: