Reputation: 4150
I am Connecting to the database at initialization of my Application through ServletContext Listener. I am able to utilize all the Connection I get from the database except the Connections where I am passing values direct to the JSP without Going through the servlet.
For Example I have a Vector Method in My DAO Class that returns a Collection of values which I am populating to a drop down in the JSP like this:
<jsp:useBean id="obj" class ="mypackage.MyDAOClass" scope="page"/>
......
My drop down
<c:forEach var ='item" items=${obj.campusCodes}">
<option>${item}</option>
</c:forEach>
I have set an attribute database in My ContextServletListener like this:
Connection conn = db.getDBConnection(url,sid,dbuser,dbpass,dbdriver,dbport,dbhost);
context.setAttribute("database", conn);
How Can I still be able to populate my drop down with this Arrangement or Do I need to change Anything?
Upvotes: 0
Views: 155