This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
**SOLVED** tag handler outputting localised text - how to do this?
posted 6 years ago
Solved (see bottom of message).
Been trying to find out how to output localised text from my tag handler. My handler extends SimpleTagSupport. This is the road I've gone down: After some searching I found the class LocaleSupport which says:
This class may be useful to any tag handler implementation that needs to produce localized messages. For example, this might be useful for exception messages that are intended directly for user consumption on an error page.
Hope someone can help me with this! Perhaps there's a more direct, better way?
Rather than extending from SimpleTagSupport, I extended my tag handler from BodyTagSupport. I could still specify (in the TLD file) that the handler expects an empty body. Subclasses of BodyTagSupport get access to the pageContext variable which is exactly what needs to be supplied as the first parameter to the LocaleSupport methods.