<%@ 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 style = request.getParameter("style");
  if( style == null ) style = "html";
  String userStyleLoc="../xml/xmldom/style/" + 
                      ("html".equals(style)?"rowset":"plaintext")+ ".xsl";

  if( "html".equals(style) ) { %>
<FONT size+=1><B>Transform DBQuery Tag Example</B></FONT><BR><BR>
Current Time=<%=new java.util.Date() %><BR>
<% } else { %> 
Transform DBQuery Tag Example
Current Time=<%= new java.util.Date() %>
<% } %>
<ojsp:cache TTL="60"> 
<%-- You can cache HTML in Oracle Web Cache with JESI
  or you can cache it in Oracle Java Web Cache --%>
Cached Time=<%= new java.util.Date() %>
<sql:dbOpen connId="conn1" URL='<%= session.getValue("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>
