01: package com.technoetic.xplanner.format;
02:
03: import org.apache.struts.Globals;
04: import org.apache.struts.util.MessageResources;
05:
06: import javax.servlet.http.HttpServletRequest;
07: import javax.servlet.http.HttpSession;
08: import java.util.Locale;
09:
10: import com.technoetic.xplanner.util.LocaleUtil;
11:
12: public class AbstractFormat {
13:
14: public static String getFormat(HttpServletRequest request,
15: String key) {
16: HttpSession session = request.getSession();
17: Locale locale = LocaleUtil.getLocale(session);
18: MessageResources resources = (MessageResources) request
19: .getAttribute(Globals.MESSAGES_KEY);
20: return resources.getMessage(locale, key);
21: }
22:
23: }
|