struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sri Sankaran" <>
Subject RE: Page scope bean and nested:iterate
Date Fri, 13 Dec 2002 16:24:20 GMT
The id attribute of the <nested:iterate> is a handle to the current element in the iteration.
 So, by definition, the reference cannot be null -- 'cos if it were, you'd be out of the iteration.
 Make sense?  So, methinks you *shouldn't* need to test if it is present. 

I know all this doesn't explain your NPE.

Just for grins can you try changing the 

<nested:write property="name"/>



If 'element' is null, *that* should blow up too.  I am puzzled as to how the bean at element
can be null.

Sorry if this didn't help any bit.


-----Original Message-----
From: Jim Krygowski [] 
Sent: Friday, December 13, 2002 10:51 AM
To: Struts Users Mailing List
Subject: Page scope bean and nested:iterate


I'm using nested:iterate and have not been successful in using the id attribute of the iterate
tag.  The documentation for nested:iterate is just the documentation for logic:iterate so
I would imagine that nested:iterate should support id.

I have some code like where theBean is the source of the objects I'm iterating over:

	<nested:iterate id="element" indexId="currentIndex" property="theBean">
	   <logic:present name="element">
	   <nested:write property="name"/><br>


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.  Why?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message