Development Shack Technology Understood

Placing MySQL JDBC URL inside your web.xml  

When placing a JDBC URL into the /WEB-INF/web.xml configuration file, make sure to URL-encode the connection string (especially the ampersand symbol):

<context-param>
    <param-name>ConnectionString</param-name>
    <param-value>jdbc:mysql://127.0.0.1/?user=java&amp;password=java</param-value>
</context-param>

To access this variable simply use the ServletContext class:

request.getServletContext().getInitParameter("ConnectionString")