You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Chris Butler <cb...@mateso.com> on 2003/03/13 22:28:05 UTC

RE: Question about NestedIterateTag (also: nested:iterate & nested:root)

I seem to be having a very similarly related problem with respect to
nested:iterate and jsp:include.  I've found that the index is lost and
it always finds the name for the first element in the collection only.

A simple test that I've done - I've attached.

Chris

-----Original Message-----
From: Bhamani, Nizar A TL56E [mailto:Nizar.Bhamani@ace-ina.com] 
Sent: Thursday, March 13, 2003 4:01 PM
To: 'Struts Users Mailing List'
Subject: Question about NestedIterateTag

We have written our own tag to print a bunch of fields read from an XML
file. I am using various NestedTextTag, NestedRadioTag, NestedSelectTag,
NestedOptionsTag and it all works fine.

I had to enhance this to use iterations of a list of fields and am using
NestedIterateTag.


However using NestedIterateTag dosen't seem to iterate over the
collection
As expected. It just prints prints out the first object from the
collection.

Has anybody has experience using the NestedIterateTag ???


Here is the logic in short:


public class MyTag extends NestedWriteTag implements NestedNameSupport
{
	public int doStartTag() throws JspException
	{
		// Some stuff removed ....

		NestedIterateTag iterateTag = new NestedIterateTag();
		iterateTag.setParent(this);
		iterateTag.setPageContext(pageContext);

		// "theCollectionProperty" is of ArrayList type.
		iterateTag.setProperty("theCollectionProperty");
		iterateTag.doStartTag();


		// Do some stuff to use NestedTextTag, NestedRadioTag
etc
and
		// set their parent as iterateTag.
		
		iterateTag.doEndTag();

		return (SKIP_BODY);		
	}

}


Again, the iteration works only for the first element in the collection.

Doesn't work for all the elements in the collection.


Any help would be appreciated.

Thanks,

Nizar.

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