* Resolves messages.
*/
private static class MessageSourcePropertyAccessor implements PropertyAccessor {
public Object getProperty(Map context, Object target, Object name) throws OgnlException {
MessageSource messageSource = (MessageSource) target;
ExternalContext externalContext;
Object root = Ognl.getRoot(context);
if (root instanceof RequestContext) {
externalContext = ((RequestContext) root).getExternalContext();
} else {
externalContext = ExternalContextHolder.getExternalContext();
}
if (externalContext != null) {
return messageSource.getMessage(name.toString(), null, null, externalContext.getLocale());
} else {
return messageSource.getMessage(name.toString(), null, null, null);
}
}