Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing messageressource in taglib

 
snoofle
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello all,
has anybody an idea how i can access the MessageRessources in a Taglib ?
tia
andreas spiessl
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
You can do it the dirty way:
private static MessageResources messages = MessageResources.getMessageResources("lae.resources.ApplicationResources");

the complex way:
private static MessageResources messages;
protected MessageResources getResources()
{
if (messages == null)
{
ActionMappings mappings;
mappings = (ActionMappings) pageContext.getAttribute(Action.MAPPINGS_KEY
, PageContext.APPLICATION_SCOPE);
ActionServlet servlet = mappings.getServlet();
messages = servlet.getResources();
}
return messages;
}
or perhaps there is a nicer way to get the resources without knowing the name of the resource file.
Andr´┐Ż
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic