Hi Michał,
Although that approach will work, if you're creating a new message
resource bundle you may prefer the new Struts2 approach described at
http://struts.apache.org/2.x/docs/localization.html and demonstrated at
http://www.planetstruts.org/struts2-mailreader/Tour.do.
Essentially you can define a message resource per action and don't need
to write any code to use it. If your action extends ActionSupport the
resources are available through getText("some.key") and <s:text
name="some.key" />. It works well.
Additionally, if your action implements ServletContextAware, the
ServletContext will be injected into your action by the
ServletConfigInterceptor. That's a nice alternative to your call to the
static method ServletActionContext.getServletContext();
cheers,
Jeromy Evans
Post by MichaÅ LetyÅskiPost by MichaÅ LetyÅskiHow to do this in struts 2 ?
MessageResources resources = (MessageResources)
getServlet().getServletContext().getAttribute(org.apache.struts.Globals.MESSAGES_KEY);
---------------------------------------------------------------------
Sorry for that queestion, instead of getServlet()i need
ServletActionContext.
---------------------------------------------------------------------