<%!  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>
<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>
<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 dataSource="<%= dataSrcStr %>"  connId="con1">
            </sql:dbOpen>
            <sql:dbQuery connId="con1" skipRows='<%=request.getParameter("skip")%>' 
                                       maxRows='<%=request.getParameter("max")%>'>
               select * from EMP order by empno
            </sql:dbQuery>
            <sql:dbClose connId="con1" />
            <HR> 
<%
    }
%>
       </BODY> 
  </HTML> 

