wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "accessing messageressource in taglib" Watch "accessing messageressource in taglib" New topic

accessing messageressource in taglib


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

Joined: Nov 22, 2008
Posts: 18944
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
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.
subject: accessing messageressource in taglib
Similar Threads
Problem with nested iterate checkbox
Null Pointer Exception during Validation in Struts
In JSP,how i will read the link from properties file.
Struts Portlet in Weblogic Portal...Anybody who can help??
Problem with jstl