[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    setting offset of logic:iterate to a bean value ...
From:       "Charlesworth, Chico" <Chico.Charlesworth () softwareag ! co ! uk>
Date:       2001-05-31 10:17:40
[Download RAW message or body]


I'm trying to set the offset to a bean value which acts like a counter ...

Basically what i want to do is:

<logic:iterate id="firstElement" name="firstList">

<logic:iterate id="secondElement" name="secondList" offset="????"
length="1">

...

</logic:iterate>

</logic:iterate>

where the offset is the current offset of firstElement ...

any ideas?

chico

-----Original Message-----
From: David Winterfeldt [mailto:dwinterfeldt@yahoo.com]
Sent: Wednesday, May 30, 2001 5:22 PM
To: struts-user@jakarta.apache.org
Subject: Re: getting a specific ArrayList element


The iterate tag has 'offset' and 'length' as
attributes.  You should be able to use both of these
to retrieve a specific element.

http://jakarta.apache.org/struts/struts-logic.html#iterate

length - The maximum number of entries (from the
underlying collection) to be iterated through on this
page. This can be either an integer that directly
expresses the desired value, or the name of a JSP bean
(in any scope) of type java.lang.Integer that defines
the desired value. If not present, there will be no
limit on the number of iterations performed.
[RT Expr]  

offset - The zero-relative index of the starting point
at which entries from the underlying collection will
be iterated through. This can be either an integer
that directly expresses the desired value, or the name
of a JSP bean (in any scope) of type java.lang.Integer
that defines the desired value. If not present, zero
is assumed (meaning that the collection will be
iterated from the beginning.
[RT Expr]  

David

--- "Charlesworth, Chico"
<Chico.Charlesworth@softwareag.co.uk> wrote:
> 
> To iterate through a java.util.ArrayList i use
> <logic:iterate> struts tag
> and that works fine ...
> 
> but which tag do i need to use and what attribute
> settings do i need to
> access a specific ArrayList element?
> for example if i wanted to access the second element
> of my ArrayList using
> jsp, i would just do:
> 
> <%MyObject o = (MyObject) myArrayList.get(1);%>
> 
> Any ideas?
> chico
> 
> 
> 
> -- 
> The content of this e-mail is confidential, may
> contain privileged material
> and is intended solely for the recipient(s) named
> above. If you receive this
> in error, please notify Software AG immediately and
> delete this e-mail.
> 
> Software AG (UK) Limited
> Registered in England & Wales 1310740
> Registered Office: Hudson House, Hudson Way,
> Pride Park, Derby DE24 8HS


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-- 
The content of this e-mail is confidential, may contain privileged material
and is intended solely for the recipient(s) named above. If you receive this
in error, please notify Software AG immediately and delete this e-mail.

Software AG (UK) Limited
Registered in England & Wales 1310740
Registered Office: Hudson House, Hudson Way,
Pride Park, Derby DE24 8HS

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic