title: How do I access Locale from a JSP?
body: <p>I want to include a js file depending on the value of the current Locale. I have tried to access it from JSP as follows: </p>
  
  <pre><code>&lt;%@ page import="java.util.Locale" %&gt;  
  &lt;% if( ((Locale) pageContext.getAttribute("org.apache.struts.action.LOCALE",PageContext.REQUEST_SCOPE)).getLanguage().equals("de")) { %&gt;
      &lt;script src="../themes/administration/js/languages/i18nDE.js" type="text/javascript"&gt; &lt;/script&gt;
  &lt;% } else { %&gt;
      &lt;script src="../themes/administration/js/languages/i18nEN.js" type="text/javascript"&gt; &lt;/script&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>However, I am getting a <code>java.lang.NullPointerException</code> because   <code>pageContext.getAttribute("org.apache.struts.action.LOCALE",PageContext.REQUEST_SCOPE)</code> is <code>NULL</code>. </p>
  
  <p>Does anyone knows how I can solve this?</p>