File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes accessing messageressource in taglib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accessing messageressource in taglib" Watch "accessing messageressource in taglib" New topic
Author

accessing messageressource in taglib

snoofle
Greenhorn

Joined: Jan 09, 2002
Posts: 26
hello all,
has anybody an idea how i can access the MessageRessources in a Taglib ?
tia
andreas spiessl
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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´┐Ż
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: accessing messageressource in taglib