title: Setting Initialization Parameters in a Servlet
body: <p>I have to set initialization parameters based on environment to a servlet, NOT via web.xml but via code, 
  but my servlet version is not 3.0 , so I cannot use this
  <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#setInitParameter%28java.lang.String,%20java.lang.String%29" rel="nofollow">http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContext.html#setInitParameter%28java.lang.String,%20java.lang.String%29</a></p>
  
  <p>I dont have access to the servlet code so I am writing a new servlet that extends it and I want to add initialization parameters via java code ..Any suggestions?</p>
  
  <pre><code>&lt;servlet&gt;
  &lt;servlet-name&gt;abc&lt;/servlet-name&gt;
  &lt;servlet-class&gt;abc&lt;/servlet-class&gt;
  &lt;init-param&gt;
  &lt;param-name&gt;abc&lt;/param-name&gt;
  &lt;param-value&gt;localhost:2001&lt;/param-value&gt;
  &lt;/init-param&gt;
  &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  </code></pre>
  
  <p>Is there a way to do the above thing(adding init-params) by extending servlet abc and setting attributes to the servlet config (overriding init())?</p>