FileDocCategorySizeDatePackage
ParameterizedLocaleSessionServlet.javaAPI DocExample1013Sun Jan 07 17:18:58 GMT 2001None

ParameterizedLocaleSessionServlet

public class ParameterizedLocaleSessionServlet extends HttpServlet

Fields Summary
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)


    HttpSession userSession = request.getSession();
    Locale userLocale = null;

    if (userSession.isNew()) {
      String language = request.getParameter("language");
      language = nullToEmpty(language);
      String country = request.getParameter("country");
      country = nullToEmpty(country);
      String variant = request.getParameter("variant");
      variant = nullToEmpty(variant);
      userLocale = new Locale(language, country, variant);
      userSession.setAttribute("userLocale", userLocale);
    } else {
      userLocale = (Locale)userSession.getAttribute("userLocale");
    }
  
public java.lang.StringnullToEmpty(java.lang.String input)

    if (input == null)
      return "";
    else
      return input;