<%@ 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()); %> Examples of I18N Custom Tag Library Tag Usage The i18n tag library contains tags to support internationalization and localization.
Current userLocale is <%= session.getAttribute("userLocale") %>. Please select one of the following locales to test:
(English) (US English) (French) (German) (Japanese) (Browser Default)

Message Tags Example Page
Format Tags Example Page
View Multiple Bundles in Action (source)
Show Bundle Contents (source)