Objective
	- JDBC using JSTL

1. copy 
jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF\web.xml to "WEB-INF"

2. copy 
jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF\lib  to WEB-INF

3. Create a DSN by the name "MyDsn" for Oracle

4. Create table and sequence as per 
jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\database.txt

Example :
\jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster.jsp


To use Standard Tag Libraries in  your JSP Pages
1. Copy "lib" folder from CD\jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF and paste it within root\WEB-INF

2. Copy "web.xml" from CD\jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF and paste it within root\WEB-INF

3. Restart the Server






To call standard tag libraries
		<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>

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

To define the datasourse using sql tag library
	<sql:setDataSource url='jdbc:mysql://localhost/database' driver='com.mysql.jdbc.Driver' user='root' password='vedisoft'/>

	<sql:setDataSource url='jdbc:odbc:MyDsn' driver='sun.jdbc.odbc.JdbcOdbcDriver' user='scott' password='tiger'/>




To insert a record using sql tag library

<sql:update var='query'>
INSERT INTO BookMaster (BookID,BookName, Synopsis, AuthorName, PublisherName) VALUES (?,?,?,?,?)
	<sql:param value='${param.txtBookId}'/>
	<sql:param value='${param.txtBookName}'/>
	<sql:param value='${param.txtSynopsis}'/>
	<sql:param value='${param.txtAuthorName}'/>
	<sql:param value='${param.txtPublisherName}'/>
</sql:update>




To Update a record using sql tag library
<sql:update var='query'>
UPDATE BookMaster SET BookName = ?, Synopsis = ?, AuthorName = ?, PublisherName = ? WHERE BookID = ?
<sql:param value='${param.txtBookName}'/>
<sql:param value='${param.txtSynopsis}'/>
<sql:param value='${param.txtAuthorName}'/>
<sql:param value='${param.txtPublisherName}'/>
<sql:param value='${param.hidBookID}'/>
</sql:update>

To delete a record using sql tag library

<sql:update var='query'>
DELETE FROM BookMaster WHERE BookID IN(${item})
</sql:update>

To fetch records using sql tag library

<sql:query var='query'>
SELECT * FROM BookMaster
</sql:query>
<c:forEach var='row' items='${query.rowsByIndex}'>
<c:out value="${row[0]}"/>
<c:out value="${row[1]}"/>
<c:out value="${row[2]}"/>
<c:out value="${row[3]}"/>
</c:forEach>


Pre-Req
 1. copy 
jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF\web.xml to "WEB-INF"

2. copy 
jsp\JSTL\JSTL eg with Tomcat5.5\BookMaster\WEB-INF\lib  to WEB-INF

3. copy my sql connector (jdbc driver) within common\lib

4. CLASSPATH for the connector should be set

5. Restart the server


Example :
JSP\JSTL\ JSTL using MySql\JSTL eg with Tomcat5.5\BookMaster

Pre-Req :
1. Create database "books"
2. within books database create a table by the name "bookmaster"
(JSP\JSTL\ JSTL using MySql\JSTL eg with Tomcat5.5\BookMaster\database.txt)
3. Copy BookMaster.jsp within root

To execute
http://localhost:8080/BookMaster.jsp

















