As already was pointed out you have to reinitialise
sindex before you run the while loop.

There at least to options to do that:
- define a method like initStateList() and call it 
  before you enter the loop.
- reset the value in hasMoreStates() when false is returned

> -----Original Message-----
> From: Denise Mangano [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 09, 2003 10:00 PM
> To: 'Tomcat Users List'
> Subject: RE: Java Bean Scope questions (a lengthy one) [getting
> desperate]
> 
> <%                 while(formBean.hasMoreStates()) {  %> 
>                    <option value=<%= formBean.getStateList()%>><%=
> formBean.getStateList()%></option> 
> <%                 }    

> 
>   public boolean hasMoreStates()
>   {
>         if (sindex < stateArray.length)
>                 return true;
>         else
>                 return false;
>   }

> //int sindex=-1; declared at beginning of class
> public String getStateList()
>   {
>                       sindex++;
>       String stemp = stateArray[sindex];
>       return stemp;
>   }
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to