Hi,
My program is something like this:

java.util.Vector v1991=new java.util.Vector(30);
int f1=1;
int f2=10;
v1991=mb1.Sel(f1,f2);

// Here,mb1 is the bean and sel is the function where I select the
// records between employee number f1 and f2

if(request.getParameter("submitxyz")!=null)
{
f1=f1+10;
f2=f2+10;
v1991=mb1.Sel(f1,f2);
}

// submit xyz is my submit button.I get records 11 to 20 on submit
// but I need to get back here and if I click this again, I should get
// records 21 to 30.Again on click,I should get 31 to 40 and so on.

for(int l=l1;l<=(v1991.size()/6);l++) 
{
<tr>
<td width="8%">
<form method="get" name="form1" action="content.jsp">
<fieldset>
<input type="radio" name="radio" value="<%=v1991.get(i)%>">
</fieldset> 
</td>
<td width="7%">
<%
out.println(v1991.get(i).toString());
i++;
%>
</td>
<td width="17%">
<input type="text" name="text222" value="<%=v1991.get(i).toString() 
%>">
<%
i++;
%>
</td>
<td width="17%">
<input type="text" name="text333" value="<%=v1991.get(i).toString()
%>" >
<%
i++;
%>
</td>
<td width="17%">
<input type="text" name="text444" value="<%=v1991.get(i).toString()
%>">
<%
i++;
%>
</td>
<td width="17%">
<input type="text" name="text555" value="<%=v1991.get(i).toString()
%>">
<%
i++;
%>
</td>
<td width="17%">
<input type="text" name="text666" value="<%=v1991.get(i).toString 
().toString().substring(0,10)%>">
<%
i++;
%>
</td>
</tr>
<%
}
%>

Now,I want to go back to if() statement as soon as I finish this loop.This program would give me 1 to 10 records initially.When I click submitxyz (next) button,I would get 11 to 20.As soon as I get 11 to 20,if I click the button,I want to get 21 to 30.But it doesn't work...
my select query would be select * from emp where empno between f1 and f2;
(There is no problem with the syntax or query.The only problem is how to return to if() statement);
Plz help me ...........Pleeeeeeeeease....I shall be very thankful.

don't do that. You're butchering JSP for something it's not intended for.
NEVER use scriptlets, use only JSTL and custom taglibs.

Hi,
Thank u very much for the reply.But I am new to JSP.I don't know how to use custom tag libraries and JSTL.Can u please help me out with that???I shall b very thankful to u.Even a small help at this moment would b a great help for me.I tried some custom tag libraries programs.But they were out of my reach.Please help me. Thank you....Regards.....

You can store the current record position in a session scope and use it accordingly.

Integer lowerBound = session.getAttribute("lowerBound");
if(lowerBound == null)
    session.setAttribute("lowerBound", new Integer(1));
else
    session.setAttribute("lowerBound", new Integer(lowerBound.intValue() + increment));
Integer upperBound = session.getAttribute("upperBound");
if(upperBound == null)
    session.setAttribute("lowerBound", new Integer(increment));
else
   session.setAttribtue("lowerBound", new Integer(upperBound.intValue() + increment));

And do follow Jwenting's advice, he is saying the right thing. Don't make a mess of your JSP code.

and get a decent (MODERN) book on JSP/Servlet programming.
O'Reilly's JSP book or Head First JSP and Servlets are the best.

JSTL is easy to use, but you do need a primer on architecture first which those books should provide.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.