ServletContext application = sce.getServletContext();
/*
* Get the JDBC driver class name and URL from web.xml
* context init parameters
*/
String driverClass = application.getInitParameter("driverClass");
String jdbcURL = application.getInitParameter("jdbcURL");
DataSourceWrapper ds = null;
try {
ds = new DataSourceWrapper();
ds.setDriverClassName(driverClass);
ds.setUrl(jdbcURL);
}
catch (Exception e) {
application.log("Error creating connection pool: ", e);
}
EmployeeRegistryBean empReg = new EmployeeRegistryBean();
empReg.setDataSource(ds);
application.setAttribute("empReg", empReg);
NewsBean news = new NewsBean();
application.setAttribute("news", news);