11. Learning Java: JSTL, part 2 – a rant

In the 11th hours, I continued with JSTL. In this, I learned about delimits, Connections to the database. Here is another blah blah post continued. You can continue reading my blah blah post for many days to come. :)

Here are the hand written fragments.

Token:

<core:set value="Satya|Prakash:Karan" var="Names" />

<core:forTokens items="${names}" var="name" delims=":|" />

<core:out value="${names}" /> <br/>

</core:forToken>

Datebase Connection:

Add library: jstl/sql-rt. Prefix given : sql

<sql:setDataSource Driver="com.mysql.jdbc.Driver" var="conn" Database="jdbc:mysql://127.0.0.1:3306/java" />

<sql:query DataSource="${conn}" query="select * from tableName where eno=1" var="table" />

${table.columnNames}

${table.rows}

${table..rowsByIndex}

----

<core:forEach items="${table.columnNames}"  var="columns" >

<td> <core:out value="${columns}" /></td>

</core:forEach>

---

<core:forEach items="${table.rows}" var="Row">
<td> <core:out value ="${Row.Eno}"/> </td>
<td> <core:out value ="${Row.Ename}"/> </td>
<td> <core:out value ="${Row.Salary}"/> </td>
<td> <core:out value ="${Row.Email}"/> </td>
<td> <core:out value ="${Row.Address}"/> </td>
</core:forEach>