<%! String dataSrcStr; %>
<%@ include file="checkDataSource.jsp" %>

<%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/sqltaglib.tld" prefix="sql" %>
<html>
    <head>
        <title>A simple tag with skipRows and maxRows</title>
    <head>
</html>
<BODY BGCOLOR="#FFFFFF"> 

<%
   if(request.getParameter("skip")== null && request.getParameter("max") == null) {
%>
<FORM METHOD=post>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="20%">
<TR><TD>skipRows:</TD><TD><INPUT TYPE="text" name="skip"></TD></TR>
<TR><TD>maxRows:</TD><TD><INPUT TYPE="text" name="max"></TD></TR>
</TABLE>
<INPUT TYPE="submit" value="Send">
</FORM>
<%
   }
   else if(request.getParameter("skip")== null && request.getParameter("max") != null) {
%>
<FORM METHOD=post ACTION="./sample7.jsp">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="20%">
<TR><TD>skipRows:</TD><TD><INPUT TYPE="text" name="skip"></TD></TR>
</TABLE>
<INPUT TYPE="submit" value="Send">
</FORM>
<%
   }
   else if(request.getParameter("skip")!= null && request.getParameter("max") == null) {
%>
<FORM METHOD=post ACTION="./sample7.jsp">
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="20%">
<TR><TD>maxRows:</TD><TD><INPUT TYPE="text" name="max"></TD></TR>
</TABLE>
<INPUT TYPE="submit" value="Send">
</FORM>
<%
   }
   else{  
%> 
            <HR>
            <sql:dbOpen connId="con1" dataSource="<%= dataSrcStr %>"  />
            <sql:dbQuery connId="con1" output="jdbc" queryId="myquery" skipRows='<%=request.getParameter("skip")%>' 
                                       maxRows='<%=request.getParameter("max")%>'>
               select ENAME from EMP order by ename
            </sql:dbQuery>
            <sql:dbNextRow queryId="myquery">
                <%= myquery.getString(1) %> <br>
            </sql:dbNextRow>
            <sql:dbCloseQuery queryId="myquery" />
            <sql:dbClose connId="con1" />
            <HR>
<%
    }
%>
       </BODY> 
  </HTML> 


