You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rama Krishna <kr...@hotmail.com> on 2001/07/06 19:46:03 UTC

iterate: offset

hi all,

i am trying to iterate with length and offset when length="1" all the time and offset gets incremented with each outer iteration.

i am trying to do something like this

<% int row=0; %>
<logic:iterate .......>

<logic:iterate ... length="1" offset='<%= "\""+row+"\"" %>'>


<% row++; %>
</logic:iterate>
</logic:iterate>

as offset takes an string i am enlosing the int in quotes. no errors, but the value remains the same.

did any one try this.

any help is greatly appreciated.

thanks,
rama.

Re: iterate: offset

Posted by Rama Krishna <kr...@hotmail.com>.
yes niall, doing multiple iterations in parallel, one for
querystrings(hashmap) and the other for report generation. will try as you
said.

thanks much,
rama.

----- Original Message -----
From: "Niall Pemberton" <ni...@btInternet.com>
To: <st...@jakarta.apache.org>
Sent: Saturday, July 07, 2001 2:46 PM
Subject: RE: iterate: offset


> Rama
>
> I tried what you wrote below and the jsp ,didnt compile.
>
> This did though, and worked :-)
>
>   <% int row=0; %>
>   <logic:iterate .......>
>     <logic:iterate ... length="1" offset='<%= ""+row %>'>
>
>        <% row++; %>
>     </logic:iterate>
>   </logic:iterate>
>
> Also an alternative would be to use the indexId of the IterateTag which
> means you dont have to declare and increment your "row" variable.
>
>   <logic:iterate indexId="row" .......>
>
>     <logic:iterate ... length="1" offset='<%= row.toString() %>'>
>     </logic:iterate>
>
>   </logic:iterate>
>
> Just out of interest - this looks like a solution to iterating through
> multiple collections in parallel - is that what your using it for?
>
> Niall
>
>
> -----Original Message-----
> From: Rama Krishna [mailto:krishkolli@hotmail.com]
> Sent: 06 July 2001 18:46
> To: struts-user@jakarta.apache.org
> Subject: iterate: offset
>
>
> hi all,
>
> i am trying to iterate with length and offset when length="1" all the time
> and offset gets incremented with each outer iteration.
>
> i am trying to do something like this
>
> <% int row=0; %>
> <logic:iterate .......>
>
> <logic:iterate ... length="1" offset='<%= "\""+row+"\"" %>'>
>
>
> <% row++; %>
> </logic:iterate>
> </logic:iterate>
>
> as offset takes an string i am enlosing the int in quotes. no errors, but
> the value remains the same.
>
> did any one try this.
>
> any help is greatly appreciated.
>
> thanks,
> rama.
>
>

RE: iterate: offset

Posted by Niall Pemberton <ni...@btInternet.com>.
Rama

I tried what you wrote below and the jsp ,didnt compile.

This did though, and worked :-)

  <% int row=0; %>
  <logic:iterate .......>
    <logic:iterate ... length="1" offset='<%= ""+row %>'>

       <% row++; %>
    </logic:iterate>
  </logic:iterate>

Also an alternative would be to use the indexId of the IterateTag which
means you dont have to declare and increment your "row" variable.

  <logic:iterate indexId="row" .......>

    <logic:iterate ... length="1" offset='<%= row.toString() %>'>
    </logic:iterate>

  </logic:iterate>

Just out of interest - this looks like a solution to iterating through
multiple collections in parallel - is that what your using it for?

Niall


-----Original Message-----
From: Rama Krishna [mailto:krishkolli@hotmail.com]
Sent: 06 July 2001 18:46
To: struts-user@jakarta.apache.org
Subject: iterate: offset


hi all,

i am trying to iterate with length and offset when length="1" all the time
and offset gets incremented with each outer iteration.

i am trying to do something like this

<% int row=0; %>
<logic:iterate .......>

<logic:iterate ... length="1" offset='<%= "\""+row+"\"" %>'>


<% row++; %>
</logic:iterate>
</logic:iterate>

as offset takes an string i am enlosing the int in quotes. no errors, but
the value remains the same.

did any one try this.

any help is greatly appreciated.

thanks,
rama.