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

 
<html>
<head>


<title>
Simple sql query demo
</title>
</head>
<body bgcolor="white"  text="#400040" link="blue" alink="black" vlink="red">

DBusername = <c:out value="${initParam.DBusername}"/><br>
DBconn_string=<c:out value="${initParam.DBconn_string}"/>

<h1>simple query demo</h1>

<sql:setDataSource 
 driver="com.mysql.jdbc.Driver"
 url="${initParam.DBconn_string}"
 user="${initParam.DBusername}"
 password="${initParam.DBpassword}" />
 
 
  
   <sql:query var="result" >
     Select username, password, email, id from calendar
   </sql:query>
   
   
  <pre>  <!-- to keep tabs for copying to excel -->
   <c:forEach items="${result.rows}" var="row"><c:out escapeXml ="false" value="${row.username}	${row.password}	${row.email}	${row.id}" />
   </c:forEach>
  </pre>
  
     
 Get the Calendar string =
        <sql:query var="result" >
          select sched from calendar
   </sql:query>
   
(just print out the calendar:<br>
      ${result.rows[0]} <br>

  <br><br>Server=

<%= request.getServerName() %>
</body>
</html>


 
