%@ page import="java.util.Date" %> <%@ page import="java.util.Locale" %> <% String lang = request.getParameter("language"); if ( "en".equals(lang) ) { session.setAttribute("userLocale",Locale.ENGLISH); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } else if ( "en-US".equals(lang) ) { session.setAttribute("userLocale",Locale.US); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } else if ( "fr".equals(lang) ) { session.setAttribute("userLocale",Locale.FRENCH); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } else if ( "de".equals(lang) ) { session.setAttribute("userLocale",Locale.GERMAN); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } else if ( "ja".equals(lang) ) { session.setAttribute("userLocale",Locale.JAPANESE); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } else if ( "browser".equals(lang) ) { session.removeAttribute("userLocale"); // redirect to remove the ?userLocale= parameter response.sendRedirect("index.jsp"); return; } %> <% System.out.println("locale = " + pageContext.getResponse().getLocale()); %>