Hi all,
I am developing a web app where I am using mysql as a database.
Now I want to build the db connection
String using the parameter defined in the <context-param> tag of <web-app>
Here is my context param which I have put under <web-app> tag.
<context-param>
<param-name>serverName</param-name>
<param-value>localhost</param-value> <param-name>dbName</param-name>
<param-value>testDataBase</param-value>
<param-name>userName</param-name>
<param-value>user1</param-value>
<param-name>password</param-name>
<param-value>password1234 </param-value>
</context-param>
Now when I try to access these parameters for eg: serverName using following code.
ServletContext sc = event.getServletContext();
String serverName = "";
serverName = sc.getInitParameter("serverName"); I am getting the value of serverName as null.
can anyone help me in this regard?
Thanks in advance