You copied me online. I copied you... 78 errors... forget it... some netizens said it was wrong... actually .. it cannot be wrong... there should be no relationship between local conditions ..
I paste my code
[Javascript]
ImportPackage (Packages. java. io, Packages. java. util, Packages.java.net );
ImportPackage (Packages. javax. servlet. http );
Req = reportContext. getHttpServletRequest ();
PropPath = "/WEB-INF/jdbc. properties"; www.2cto.com
Url = req. getSession (). getServletContext (). getResource (propPath); // obtain the relative path of the configuration file
If (url! = Null) // If the relative path of the file is not empty, read the configuration file
{
Props = new java. util. Properties ();
Props. load (url. openStream ());
ExtensionProperties. odaURL = new String (props. getProperty ("jdbc. url "));
ExtensionProperties. odaDriverClass = new String (props. getProperty ("jdbc. driverClassName "));
ExtensionProperties. odaUser = new String (props. getProperty ("jdbc. username "));
ExtensionProperties. odaPassword = new String (props. getProperty ("jdbc. password "));
}