you need to add the collection to the request object

    java.util.Collection roles = client.getUserRoles("admin");

    request.setAttribute("roles");

then

   logic:iterate id="element" name="roles">

 this will work


--- Simon Liang <[EMAIL PROTECTED]> wrote:
> hi:
> 
> I tried the suggestion, but still didn't work. This seem to work.
> 
> <!-------------------- The code ----------------------%>
> <%
>  java.util.Collection roles = client.getUserRoles("admin");
> %>
> ... 
> <logic:iterate id="element" collection="<%=roles%>">
>       <h4>Next element is <bean:write name="element"/></h4>
> </logic:iterate> 
> <!-----------------------End The code ----------------%>
> 
> Simon
> 
> 
> 
> -----Original Message-----
> From: Shoulico [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 26, 2001 11:25 AM
> To: [EMAIL PROTECTED]
> Subject: Re: iterate collection
> 
> 
> <logic:iterate id="element" collection="roles">
>  
> should be 
>   
>  <logic:iterate id="element" name="roles">
> 
> 
> 
> 
> --- Simon Liang <[EMAIL PROTECTED]> wrote:
> > Hi:
> > 
> > Can someone help with this? I can't find an example whether struts
> > iterate
> > throught a collection.
> > <!-------------------- The code ----------------------%>
> > <%
> > java.util.Collection roles = client.getUserRoles("admin");
> > %>
> > 
> > <logic:iterate id="element" collection="roles">
> > <H4>Next element is <bean:write name="element"
> > property="value"/></H4>
> > </logic:iterate> 
> > <!------------------End the code ---------------------%>
> > 
> > 
> > The error:
> > 
> > admin/umModifyOrg.jsp(-1): Error in tag library at: 'logic': for
> tag
> > 'iterate', property 'collection' of tag handler class
> > 'org.apache.struts.taglib.logic.IterateTag', the property value
> must
> > be a
> > runtime expression "<%=...%>", since we cannot do an automatic
> > convertion
> > from "roles" to type 'java.lang.Object'
> > probably occurred due to an error in /admin/umModifyOrg.jsp line
> -1:
> > 
> > 
> > 
> > 
> > 
> >
>
============================================================================
> > This message is intended only for the use of the Addressee(s) and
> may
> > contain information that is PRIVILEGED and CONFIDENTIAL. If you are
> > not
> > the intended recipient, dissemination of this communication is
> > prohibited.
> > If you have received this communication in error, please erase all
> > copies
> > of the message and its attachments and notify
> > [EMAIL PROTECTED]
> > immediately.
> >
>
============================================================================
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> 
>
============================================================================
> This message is intended only for the use of the Addressee(s) and may
> contain information that is PRIVILEGED and CONFIDENTIAL. If you are
> not
> the intended recipient, dissemination of this communication is
> prohibited.
> If you have received this communication in error, please erase all
> copies
> of the message and its attachments and notify
> [EMAIL PROTECTED]
> immediately.
>
============================================================================
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Reply via email to