Calling if

Hi,

I have an if statement in my jsp program which fetches me the value of next button.

Vector v1991=new Vector(30);

if(request.getParameter("submitxyz")!=null)

{

x=x+10;

v1991=mb1.Sel(x);

}

for()

{

}

But this would execute only once.I want that as soon as for loop is finished,the control should go back to the if statement and if I press the button,the action should happen again.i.e.,every time after finishing for loop,if I press the button submitxyz, x value should b incremented by 10,till it reaches the last record.i.e. till vector v1991 becomes empty.Can anyone help plz?Plz let me know if u have any doubts.Till now,even a single doubt has not been clarified.Plz help...I shall b very thankful....

[780 byte] By [ali_mohammeda] at [2007-11-27 4:53:59]
# 1
Have a boolean variable and if your condition met, use continue and break statements. I think you would need to redo the logic.
skp71a at 2007-7-12 10:08:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

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.

ali_mohammeda at 2007-7-12 10:08:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
How about using the if in a while true loop , quitting the loop on completing the desired records.
ReshmaCBa at 2007-7-12 10:08:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hi,

I have done using while().As soon as I use while(),the page gets stuck up.I tried using while().I am not exactly sure when and where I am supposed to use while(). Can U just help me in that way?How about using break and continue?Since u have the code,just tell me where to add break and continue.

Thanks a lot for the response....

ali_mohammeda at 2007-7-12 10:08:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...