tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject RE: Java Bean Scope questions (a lengthy one) [getting desperate]
Date Fri, 10 Jan 2003 08:23:30 GMT

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:DeniseM@complusdata.com]
> 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:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message