You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/12/07 15:59:02 UTC
DO NOT REPLY [Bug 15159] New: -
Iterate tag collection attribute does not work
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15159>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15159
Iterate tag collection attribute does not work
Summary: Iterate tag collection attribute does not work
Product: Struts
Version: 1.1 Beta 2
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Custom Tags
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: mikael.lindkvist@infodata.sema.se
If you try to iterate over an array of objects that has been stored into a
context (request, page, session) using the iterate tag like this
<logic:iterate id="elem" collection="myArray"> will fail with a "cant get
iterator" message.
When I look in the source code for the iterator tag I can see that startTag()
method starts with:
// Acquire the collection we are going to iterate over
Object collection = this.collection;
if (collection == null)
collection =
RequestUtils.lookup(pageContext, name, property, scope);
This means that if the collection attribute is supplied as a String the actual
String value will be treated as a collection (and fail) instead of used as a key
to find the corresponding collection/array in the context.
I suggest changing the code above to something like:
// Acquire the collection we are going to iterate over
Object collection = this.collection;
if (collection == null)
collection =
RequestUtils.lookup(pageContext, name, property, scope);
else
collection =
RequestUtils.lookup(pageContext, this.collection.toString(),
scope);
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>