<context-param> <param-name>dBinfo</param-name> <paramvalue>jdbc:microsoft:sqlserver://10.29.9.44:1433;DatabaseName=usrmgt</param-value> </context-param> I am able to access the dBinfo value in servlets/jsp using ServletContext servletContext = this.getServletContext(); String value = servletContext.getInitParameter("dBinfo") Question is how can I access dBinfo in a java class under webapp(not a servlet) ??? Thanks
I don't believe you can .... unless you pass in the servletcontext object as a parameter to the class constructor. What I have done in a similar situation is to use the servlet listener interfaces to create a database connection when the servlet is initialized and pass that to the helper classes instead. You can also use them to close the connection when the servlet context is destroyed. Hope that helps
Can you smell this for me? I think this tiny ad smells like blueberry pie!
a bit of art, as a gift, the permaculture playing cards