Get servlet init params in servlet context listener
<pre><code> &lt;listener&gt;
    &lt;listener-class&gt;config&lt;/listener-class&gt;
&lt;/listener&gt; 
  &lt;servlet&gt;
&lt;servlet-name&gt;ProcessReg&lt;/servlet-name&gt;
&lt;servlet-class&gt;ProcessReg&lt;/servlet-class&gt;
&lt;init-param&gt;
    &lt;param-name&gt;text&lt;/param-name&gt;
    &lt;param-value&gt;HelloWorld1&lt;/param-value&gt;
&lt;/init-param&gt;
</code></pre>

<p></p>

<pre><code>public class config implements ServletContextListener {



@Override
public void contextInitialized(ServletContextEvent event) {
    ServletContext servletContext = event.getServletContext();
    String text1 = servletContext.getInitParameter("text");
</code></pre>

<p>In method  <code>contextInitialized(ServletContextEvent event)</code> , If There would be two servlets , for example , Let's say name of the second  servlet be <code>Servlet2</code> and it  let's  say  has also has <code>init - param</code> called <code>text</code> with value <code>HelloWorld2</code> .</p>

<p>How does <code>listener</code>   know to take <code>ProcessReg</code> servlet ? </p>

<p>How to get <code>param</code> from <code>Servlet2</code> ??</p>