title: JSP Servlet Overriding Resource Bundle from Property Files in External Path
body: <p>Iam using JSP/Servlet Application.
  I want to override the ResourceBundle as i have the Properties in external path(not inside war). 
  I am not able to access the ResourceBundle in the JSP.</p>
  
  <p>My ResouceBundle Name is ApplicationResources.properties. I have Properties for other locale as well.
  In JSP, the fmt tags are as shown below</p>
  
  <pre><code> &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %&gt;
     &lt;fmt:setBundle basename="ApplicationResources" /&gt;
  </code></pre>
  
  <p>In Web.xml, the following configuration is used for JSTL </p>
  
  <pre><code> &lt;context-param&gt;
      &lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localizationContext&lt;/param-name&gt;
      &lt;param-value&gt;ApplicationResource&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>The Following MyResourceBundle is not executed when application starts. Is there any configuration needs to be added in web.xml?</p>
  
  <pre><code>    public class MyResourceBundle extends ResourceBundle {
      public MyResourceBundle(){
              File file = new File("C:\\Prop"); 
              ClassLoader loader=null;
              try {
                  URL[] urls = {file.toURI().toURL()};  
                  loader = new URLClassLoader(urls); 
                  ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources", Locale.getDefault(), loader);
                  setParent(bundle);
              } catch (MalformedURLException ex) { 
                  System.out.println("RESOURCe EXCEP");
              }
      }
  
  @Override
  protected Object handleGetObject(String key) {
        return parent.getObject(key);
  }
  
  @Override
  public Enumeration&lt;String&gt; getKeys() {
       return parent.getKeys();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Is there any error in above code?
  Is it possible to override the resourcebundle in JSP/Servlet?</p>