You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ralf Rapude <ra...@web.de> on 2003/12/05 12:19:46 UTC

iterate over one collection two times in a jsp

Hi,
with a logic:iterate tag I run over a Collection:

<logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
  <logic:iterate id="subjects" name="<%=Constants.SUBJECTS %>">
    ...output
  </logic:iterate>
</logic:present>

It works well but if I try to iterate over the same collection after
changing the id (but still in the same jsp):

<logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
  <logic:iterate id="subjectsmain" name="<%=Constants.SUBJECTS %>">
    ... output
  </logic:iterate>
</logic:present>

I got this Exception -> Cannot create iterator for this collection

It works if I put my collection under a different name in the
session-scope, but in my Opinion there must be a more proper way to
handle the problem.

Thanks a lot
Ralf




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: iterate over one collection two times in a jsp

Posted by James Mitchell <jm...@apache.org>.
On Fri, 5 Dec 2003, Gurpreet Dhanoa wrote:

> hi Ralf
>
> I am facing the same trouble. If u come to know the answer Please let me
> know as well

Not sure if this helps, but I do this in several places on my app.
However, I use JSTL <c:forEach> tag.



> Thanks in Advance
> Gary
> ----- Original Message -----
> From: "Ralf Rapude" <ra...@web.de>
> To: <st...@jakarta.apache.org>
> Sent: Friday, December 05, 2003 4:49 PM
> Subject: iterate over one collection two times in a jsp
>
>
> > Hi,
> > with a logic:iterate tag I run over a Collection:
> >
> > <logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
> >   <logic:iterate id="subjects" name="<%=Constants.SUBJECTS %>">
> >     ...output
> >   </logic:iterate>
> > </logic:present>
> >
> > It works well but if I try to iterate over the same collection after
> > changing the id (but still in the same jsp):
> >
> > <logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
> >   <logic:iterate id="subjectsmain" name="<%=Constants.SUBJECTS %>">
> >     ... output
> >   </logic:iterate>
> > </logic:present>
> >
> > I got this Exception -> Cannot create iterator for this collection
> >
> > It works if I put my collection under a different name in the
> > session-scope, but in my Opinion there must be a more proper way to
> > handle the problem.
> >
> > Thanks a lot
> > Ralf
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

-- 
James Mitchell
Software Developer / Struts Evangelist
http://www.struts-atlanta.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: iterate over one collection two times in a jsp

Posted by Lynn Guy <lg...@yahoo.com>.
I've done this and I just repeat exactly the same iterate with different output and it works fine.

Gurpreet Dhanoa <gu...@smartdatainc.com> wrote:hi Ralf

I am facing the same trouble. If u come to know the answer Please let me
know as well
Thanks in Advance
Gary
----- Original Message -----
From: "Ralf Rapude" 
To: 
Sent: Friday, December 05, 2003 4:49 PM
Subject: iterate over one collection two times in a jsp


> Hi,
> with a logic:iterate tag I run over a Collection:
>
> " scope="session">
> ">
> ...output
> 
> 
>
> It works well but if I try to iterate over the same collection after
> changing the id (but still in the same jsp):
>
> " scope="session">
> ">
> ... output
> 
> 
>
> I got this Exception -> Cannot create iterator for this collection
>
> It works if I put my collection under a different name in the
> session-scope, but in my Opinion there must be a more proper way to
> handle the problem.
>
> Thanks a lot
> Ralf
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: iterate over one collection two times in a jsp

Posted by Gurpreet Dhanoa <gu...@smartdatainc.com>.
hi Ralf

I am facing the same trouble. If u come to know the answer Please let me
know as well
Thanks in Advance
Gary
----- Original Message -----
From: "Ralf Rapude" <ra...@web.de>
To: <st...@jakarta.apache.org>
Sent: Friday, December 05, 2003 4:49 PM
Subject: iterate over one collection two times in a jsp


> Hi,
> with a logic:iterate tag I run over a Collection:
>
> <logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
>   <logic:iterate id="subjects" name="<%=Constants.SUBJECTS %>">
>     ...output
>   </logic:iterate>
> </logic:present>
>
> It works well but if I try to iterate over the same collection after
> changing the id (but still in the same jsp):
>
> <logic:present name="<%=Constants.SUBJECTS %>" scope="session" >
>   <logic:iterate id="subjectsmain" name="<%=Constants.SUBJECTS %>">
>     ... output
>   </logic:iterate>
> </logic:present>
>
> I got this Exception -> Cannot create iterator for this collection
>
> It works if I put my collection under a different name in the
> session-scope, but in my Opinion there must be a more proper way to
> handle the problem.
>
> Thanks a lot
> Ralf
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org