Hi all,
I need to access mysql db from multiple servlet i,e need to insert the value from one servlet and retrieve from another servlet.i passed the connection variables through web.xml file. i need to get those variables from both the servlets to connect the db again.how to achieve that or Is there any other way to connect database from multiple servlets..
my xml codes

<servlet>
    <servlet-name>LoginServlet</servlet-name>
    <servlet-class>LoginServlet</servlet-class>
    <init-param>
      <param-name>jdbcDriver</param-name>
      <param-value>com.mysql.jdbc.Driver</param-value>
    </init-param>
    <init-param>
      <param-name>dbURL</param-name>
      <param-value>jdbc:mysql://localhost:3306/invoice</param-value>
    </init-param>
    <init-param>
      <param-name>dbUserName</param-name>
      <param-value>root</param-value>
    </init-param>
    <init-param>
      <param-name>dbPassword</param-name>
      <param-value></param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>LoginServlet</servlet-name>
    <url-pattern>/controller/login</url-pattern>
  </servlet-mapping>
<servlet>
    <servlet-name>UserServlet</servlet-name>
    <servlet-class>UserServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UserServlet</servlet-name>
    <url-pattern>/controller/user</url-pattern>
  </servlet-mapping>

By using the web container's connection pool and JNDI.

See your web containers documentation and the JEE Tutorials.