You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Richards <gr...@cyber4.org> on 2001/03/25 05:14:15 UTC
never ending iterate tag questions
I've now got the <logic:iterate ...> tag to work, but I'm confused about how it
works with the collection attribute. I've seen examples for people where they
have
<logic:iterate id="bean" collection="<%= someObject.getValues() %>">
... do something with bean ...
</logiv:interate>
but the documentation
http://jakarta.apache.org/struts/api/org/apache/struts/taglib/logic/package-summary.html#package_description
indicates that it should be used thus:
<logic:iterate id="bean" collection="<% someObject.getValues() %>">
... do something with bean ...
</logiv:interate>
The difference here being the "=" inside the scriptlet for the collection attribute.
When I don't have the "=" as the documentation suggests, I get
Unable to convert a String to java.lang.Object for attribute collectio
and if I do use the "=", which seem to be the correct way, looking at the generated
Java code, I get the correct response.
--
Kumera - a new Open Source Content Management System
for small to medium web sites written in Perl and using XML
http://www.cyber4.org/kumera/index.html
Re: never ending iterate tag questions
Posted by Martin Cooper <ma...@tumbleweed.com>.
You've found a documentation bug, which I have just submitted to the bug
database.
As you discovered, you need to use an expression (e.g. <%= value %>) rather
than a scriptlet (e.g. <% method(); %>) because the value needs to be
returned so that it can be used in the attribute.
--
Martin Cooper
----- Original Message -----
From: "Jim Richards" <gr...@cyber4.org>
To: <st...@jakarta.apache.org>
Sent: Saturday, March 24, 2001 7:14 PM
Subject: never ending iterate tag questions
>
> I've now got the <logic:iterate ...> tag to work, but I'm confused about
how it
> works with the collection attribute. I've seen examples for people where
they
> have
>
> <logic:iterate id="bean" collection="<%= someObject.getValues() %>">
> ... do something with bean ...
> </logiv:interate>
>
> but the documentation
>
>
http://jakarta.apache.org/struts/api/org/apache/struts/taglib/logic/package-
summary.html#package_description
>
> indicates that it should be used thus:
>
> <logic:iterate id="bean" collection="<% someObject.getValues() %>">
> ... do something with bean ...
> </logiv:interate>
>
> The difference here being the "=" inside the scriptlet for the collection
attribute.
> When I don't have the "=" as the documentation suggests, I get
>
> Unable to convert a String to java.lang.Object for attribute collectio
>
> and if I do use the "=", which seem to be the correct way, looking at the
generated
> Java code, I get the correct response.
>
>
>
>
>
>
> --
> Kumera - a new Open Source Content Management System
> for small to medium web sites written in Perl and using XML
> http://www.cyber4.org/kumera/index.html
Re: never ending iterate tag questions
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sun, 25 Mar 2001, Jim Richards wrote:
>
> I've now got the <logic:iterate ...> tag to work, but I'm confused about how it
> works with the collection attribute. I've seen examples for people where they
> have
>
> <logic:iterate id="bean" collection="<%= someObject.getValues() %>">
> ... do something with bean ...
> </logiv:interate>
>
> but the documentation
>
> http://jakarta.apache.org/struts/api/org/apache/struts/taglib/logic/package-summary.html#package_description
>
> indicates that it should be used thus:
>
> <logic:iterate id="bean" collection="<% someObject.getValues() %>">
> ... do something with bean ...
> </logiv:interate>
>
> The difference here being the "=" inside the scriptlet for the collection attribute.
> When I don't have the "=" as the documentation suggests, I get
>
> Unable to convert a String to java.lang.Object for attribute collectio
>
> and if I do use the "=", which seem to be the correct way, looking at the generated
> Java code, I get the correct response.
>
It looks like the docs are wrong. The version with the '=' is correct,
because you want to use a runtime expression here. Where exactly in the
documentation did you see this, so we can fix it?
Craig