The 'simple' way to fix it is to have a vector of Things. Each Thing contains a
number and a string. Then LOOP through the Things and pick off the number and the
string in parallel.
If you're clever, you might even be able to preserve your existing representation by
having getNumber(int) pull out the number from the appropriate Thing.
cc
Arie Fishler wrote:
> Hi Werner
>
> If I understand it correctly what you suggest will perform a NESTED loop
> which means that if I have j values for property x and k values for property
> y then the LOOP will produce j*k lines and I don't want it to behave like
> that. The properties have the same number of elements t and I want the LOOP
> to produce only t lines.
>
> Class Bean {
> Vector numbers;
> Vector strings;
>
> Integer getNumbers(int index ) {
> return numbers.elementAt(indesx);
> }
>
> String getStrings(int index) {
> return strings.elementAt(indesx);
> }
> }
>
> I want my dynamic page to display lines which contain a number and matching
> string on each line.
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
> reference [mailto:[EMAIL PROTECTED]] On Behalf Of Werner Hennrich
> Sent: Thursday, April 08, 1999 7:42 PM
> To: [EMAIL PROTECTED]
> Subject: AW: Loops on multiple properties
>
> Hi Arie,
>
> why don't you want to use two nested loops on the same bean?
> since they use different properties they wouldn't interfere with each other
> and create those properties' cross product (creating all inner values for
> every
> outer iteration) - I asume that is what you seek.
>
> <LOOP PROPERTY=beanA:prop1 PROPERTYELEMENT=x>
> <LOOP PROPERTY=beanA:prop2 PROPERTYELEMENT=y>
>
> x = <display PROPERTY=x> / y = <display PROPERTY=y>
>
> </LOOP >
> </LOOP >
>
> providing a specific language construct within JSP for exactly the same
> result would just
> would just increase the JSP-Handler's complexity, risk for bugs, effort to
> learn....
>
> bye, Werner
>
> > -----
> > Re: Loops on multiple properties
> >
> > Is there a way to include more than a single property in a LOOP tag? From
> > the spec it seems that the LOOP allows using a single
> > property/bean and all
> > its sub properties, but not several properties. I want to do
> > something like
> > <LOOP PROPERTY=myBean:property1 PROPERTYELEMENT=x,
> > PROPERTY=myBean:property2 PROPERTYELEMENT=y>
> >
> > and then use x and y in the LOOP body. Is there a way to do it?
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JSP-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JSP-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
begin:vcard
n:Cobb;Christopher
tel;cell:703-909-7550
tel;fax:703-648-7475
tel;work:703-648-6725
x-mozilla-html:TRUE
org:Powerhouse Technologies, Inc.
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:SW Architect
fn:Christopher Cobb
end:vcard