birt读取配置文件.properties
网上都是你抄我,我抄你...乱78遭...乱就算了...有网友说是错的...其实..也不能说错...应该是没有因地制宜的关系..我贴下我的代码
[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.zzzyk.com
url = req.getSession( ).getServletContext( ).getResource( propPath ); // 获得配置文件的相对路径
if ( url != null ) // 如果文件的相对路径不为空,则读取配置文件
{
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"));
}
补充:web前端 , JavaScript ,