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

Michał Letyński wrote:
Michał Letyński napisał(a):
How to do this in struts 2 ?
In struts 1 i had:
MessageResources resources = (MessageResources) getServlet().getServletContext().getAttribute(org.apache.struts.Globals.MESSAGES_KEY);

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Sorry for that queestion, instead of getServlet()i need ServletActionContext.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to