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/13 18:07:25 UTC
DO NOT REPLY [Bug 15367] New: -
nested:iterate id attribute doesn't 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=15367>.
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=15367
nested:iterate id attribute doesn't work
Summary: nested:iterate id attribute doesn't work
Product: Struts
Version: 1.1 Beta 2
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Normal
Priority: Other
Component: Custom Tags
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: james.krygowski@shaws.com
I'm trying to use the id attribute on nested:iterate to expose the current
iteration element for use as a PageContext JSP bean. I've coded the following
example to demonstrate the problem:
<nested:iterate id="element" indexId="currentIndex"
property="theBean">
<logic:present name="element">
<%=element.hashCode()%><br>
</logic:present>
<nested:write property="name"/><br>
<%=currentIndex.intValue()%>
</nested:iterate>
The following code runs and outputs just the value of the name
and the current index number. If I removed the logic:present, I
get a runtime error because element is null. I think this should
work, but it doesn't.
I traced into the nested iterate class and found that the id is always being
removed from the page context.
if (iterator.hasNext()) {
Object element = iterator.next();
if (element == null)
pageContext.removeAttribute(id);
else
pageContext.setAttribute(id, element);
lengthCount++;
started = true;
if (indexId != null)
pageContext.setAttribute(indexId, new Integer(getIndex()));
return (EVAL_BODY_TAG);
} else
return (SKIP_BODY);
element is always null (even though stuff is rendering on my JSP) so the id
is always getting pulled out of the pageContext. But index id keeps getting
set. This is pretty confusing and seems to be a bug. Is it?
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>