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 Hatton <ch...@qwest.net> on 2003/06/17 18:16:55 UTC

Nested recursion does not recurse!

Hi, everyone,

Am I crazy?  I have been trying to get recursion to work using Arron's 
examples at keyboardmonkey and it absolutely will not recurse.  It just 
repeats the very first element.

Here's what I get displayed in my HTML results:
--------------------------------------
USA - productTree
ALABAMA - productTree.treeNodes[0]
ALABAMA - productTree.treeNodes[0]
ALABAMA - productTree.treeNodes[0]
ALABAMA - productTree.treeNodes[0]
--------------------------------------

Why is the same nested level repeated over and over?  Note: my Form class 
returns Object arrays (i.e. TreeNode[] getTreeNodes()).

Here's productNode.jsp:

--------------------------------------
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="nested" %>

<nested:root>
  	<nested:write property="label" /> - <nested:writeNesting/><br> 	
	<nested:equal property="isExpanded" value="true"> 		<nested:iterate 
id="node" property="treeNodes"> 			<jsp:include page="productNode.jsp" /> 
		</nested:iterate> 	</nested:equal>
   </nested:root>
--------------------------------------


And the relevant code from product.jsp:
--------------------------------------
<nested:form action="submitJob.do" method="POST">
.....
	<!-- Begin Product Tree -->
	<nested:nest property="productTree">
		<jsp:include page="../product/productNode.jsp"/>
	</nested:nest>
	<!-- End Product Tree -->
....
</nested:form>
--------------------------------------

I should note that I set isExpanded (i.e. "showChildren") to true for the 
very top-level element.  I do have other (non-nested) Struts tags included 
in this page outside the ProductTree code.

I'm on Tomcat 4.1.18, RedHat 8.0, Struts 1.1 rc2, jdk 1.3.1_07.

Thanks!
	Chris Hatton
	Tobin International



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

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


Re: Nested recursion does not recurse!

Posted by Sandeep Takhar <sa...@yahoo.com>.
Are you sure you want to include a page that has a
form in it?

nested:form, nested:nest and nested:iterate all start
a new "root" element that nested will use.

Whenever you do a jsp:include always do a 

nested:root

at the beginning if you are using nested tags.

sandeep
--- Chris Hatton <ch...@qwest.net> wrote:
> Hi, everyone,
> 
> Am I crazy?  I have been trying to get recursion to
> work using Arron's 
> examples at keyboardmonkey and it absolutely will
> not recurse.  It just 
> repeats the very first element.
> 
> Here's what I get displayed in my HTML results:
> --------------------------------------
> USA - productTree
> ALABAMA - productTree.treeNodes[0]
> ALABAMA - productTree.treeNodes[0]
> ALABAMA - productTree.treeNodes[0]
> ALABAMA - productTree.treeNodes[0]
> --------------------------------------
> 
> Why is the same nested level repeated over and over?
>  Note: my Form class 
> returns Object arrays (i.e. TreeNode[]
> getTreeNodes()).
> 
> Here's productNode.jsp:
> 
> --------------------------------------
> <%@ taglib uri="/WEB-INF/tld/struts-nested.tld"
> prefix="nested" %>
> 
> <nested:root>
>   	<nested:write property="label" /> -
> <nested:writeNesting/><br> 	
> 	<nested:equal property="isExpanded" value="true"> 	
> <nested:iterate 
> id="node" property="treeNodes"> 			<jsp:include
> page="productNode.jsp" /> 
> 		</nested:iterate> 	</nested:equal>
>    </nested:root>
> --------------------------------------
> 
> 
> And the relevant code from product.jsp:
> --------------------------------------
> <nested:form action="submitJob.do" method="POST">
> .....
> 	<!-- Begin Product Tree -->
> 	<nested:nest property="productTree">
> 		<jsp:include page="../product/productNode.jsp"/>
> 	</nested:nest>
> 	<!-- End Product Tree -->
> ....
> </nested:form>
> --------------------------------------
> 
> I should note that I set isExpanded (i.e.
> "showChildren") to true for the 
> very top-level element.  I do have other
> (non-nested) Struts tags included 
> in this page outside the ProductTree code.
> 
> I'm on Tomcat 4.1.18, RedHat 8.0, Struts 1.1 rc2,
> jdk 1.3.1_07.
> 
> Thanks!
> 	Chris Hatton
> 	Tobin International
> 
> 
> 
> -- 
> Using M2, Opera's revolutionary e-mail client:
> http://www.opera.com/m2/
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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