Spring MVC: get a spring message resource programmatically 

Joined:
08/13/2009
Posts:
164

March 16, 2012 12:35:26    Last update: March 16, 2012 12:35:26
To programmatically resolve a spring message:
// import org.springframework.web.servlet.support.RequestContextUtils;
// import org.springframework.web.context.WebApplicationContext;
WebApplicationContext appCtx = RequestContextUtils.getWebApplicationContext(request);
String theMessage = appCtx.getMessage(
			"message.key",
			arguments, // Object[]
			RequestContextUtils.getLocale(request)
		    )
Share |
| Comment  | Tags