using jstl sql with a connection pool

153 views
Skip to first unread message

Pradyut

unread,
Feb 21, 2011, 2:29:37 PM2/21/11
to oop_programming


with a jndi name of jdbc_void in the container


and the following text in web.xml file


<resource-ref>
<description>MySQL Database Connection</description>
<res-ref-name>jdbc_void</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>


and the following text in jsp file:


<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>

<sql:query var="codes" dataSource="jdbc_void">
call sp_sel_user_shouts(?,?);
<sql:param>${myID}</sql:param>
<sql:param>${vis}</sql:param>
</sql:query>

<c:forEach var="row" items="${codes.rows}">
${codes.rowCount}
${row.columnName}
</c:forEach>

<c:forEach var="columnName" items="${codes.columnNames}"> <c:out
value="${columnName}"/> </c:forEach>


download the latest jstl jar file from http://tomcat.apache.org/taglibs/standard/


Pradyut
http://pradyut.tk
http://oop-edge.blogspot.com/
http://pradyutb.blogspot.com/
http://praddy-photos.blogspot.com/
http://oop-edge.spaces.live.com/
http://www.flickr.com/photos/praddy
http://groups.google.com/group/oop_programming
India
Reply all
Reply to author
Forward
0 new messages