<%@ page import="oracle.sql.*, oracle.jdbc.driver.*, oracle.jdbc.*, java.sql.*"  errorPage="error.jsp" contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/xml.tld" prefix="xml" %>
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/sqltaglib.tld" prefix="sql" %>
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/jwcache.tld" prefix="ojsp" %>
<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/jesitaglib.tld" prefix="jesi" %>

<%
   String connStr=request.getParameter("connStr");
   if (connStr==null) {
     connStr=(String)session.getValue("connStr");
   } else {
     session.putValue("connStr",connStr);
   }
   if (connStr==null) { %>
<jsp:forward page="../sql/setconn.jsp" />
<%
   }

%>

<% 
  String userStyleLoc="../xml/xmldom/style/rowset.xsl";
  // userStyleLoc can be retrieved some user personal profile 
%>

<h3>Transform DBQuery Tag Example</h3>
<h4>Current Time=<%= new java.util.Date() %></h4>
<ojsp:cache TTL="60"> 
<!-- You can cache HTML in Oracle Web Cache with JESI
  or you can cache it in Oracle Java Web Cache -->
<h4>Cached Time=<%= new java.util.Date() %></h4>
<sql:dbOpen connId="conn1" URL="<%= connStr %>"
              user="scott" password="tiger" />
<xml:transform href="<%= userStyleLoc %>" > 
<%-- The XML DOM object is produced by dbQuery
  And, the DOM object is cached in Oracle Java Web Cache.
  XSLT is performed on the cached object. --%>
  <xml:cacheXMLObj TTL="60" toWriter="false">
    <sql:dbQuery connId="conn1" output="xml" queryId="myquery" >
       select ENAME, EMPNO from EMP ORDER BY ENAME
    </sql:dbQuery>
  </xml:cacheXMLObj>
</xml:transform> 
<sql:dbCloseQuery queryId="myquery" />
<sql:dbClose connId="conn1" />
</ojsp:cache>


