Marcelo,

It's kind of fuzzy as to where you're trying to get to. There's three 
loops. So I have to assume that you want a radio button for each 
"answer" within each "test" within each "item". Say there's three 
elements in each, you'll end up with 27 radio buttons. Right so far?...

This is going off the list of items, then list of tests, then list of 
answers. With this, you should be striving for the following underlying 
property...

item[i].test[j].answers[k].radioIem

The markup should be something like this...

<nested:root name="beanNameRef">
<nested:iterate property="items">
<nested:itearate property="tests">
<nested:iterate property="answer">
<nested:radio property="answer">
</nested:iterate>
</nested:iterate>
</nested:iterate>
</nested:root>

Just to clear a few things up. The use of the nested root is to serve as 
the basis of a nested tag structure for a JSP. It takes the place of a 
<html:form> or <nested:form> as not all pages will be specified by a 
form. The tag then takes the name attribute as the name of the bean that 
the tags will then reference. You've placed it half way down the 
structure, and the danger of what will happen here is that the tags will 
assume that this is the start of a hierarchy, and start again. That's 
why the name attributes of your resulting Html doesn't have the "items" 
reference. So move the root to the start, or if there's already a form 
tag there, remove it all together.

Second... there's no real need to specify "name" attributes in the 
nested tags, as your input here will be ignored anyway :) This is 
because all the tags will be looking to their parents to get the bean 
name, as it's assumed that they're working together. The only thime that 
the name will make a difference is in the initial rooting tag.

The same almost goes for id's. Id's will define scripting variables for 
you, and nothing else. They're not a "requirement" for the nested tags 
to do their thing. To get the tags running, all you'll need are the 
"property" attributes that define the property of whatever the current 
tag is addressing.

As for your duplicate indexes... it's the first time I've come across 
it. :) ...so there's nothing that I can directly say to combat it. 
Hopefully, it will be taken care of with the above tips taken care of.

If you want to get a little more familiar with the tags from the ground 
up, there's a primer and a tutorial on my site which should take you 
through everything...
http://www.keyboardmonkey.com/struts

Get back to us if you have any other problems.

Arron.


Marcelo Caldas wrote:

>Ok, I've got progress...
>
>I've downloaded the latest struts build wich contains the NESTED tags...
>
>I'm trying to use the nested:iterate and nested:radio, but I couldn'g get grip of 
>everything from the docs that comes together... So if there's anyone out there that 
>has used the nested tags properly I'll appreciate the help..
>
>After, several tries, the best result I have is:
>
><nested:iterate id="items" ...>
>
>       <nested:itearate id="tests" ...>
>       <nested:root name="tests"
>
>               <nested:iterate id="answer" ...>
>                       <nested:radio name="answer" ...>
>               </nested:iterate>
>       </nested:root>
>       </nested:iterate>
></nested:iterate>
>
>It seems that it got almost right, but it looks like tests looses it's index 
>providing a result:
><input type="radio" name="tests[0].answer[0].responseID" value="OK">
><input type="radio" name="tests[0].answer[0].responseID" value="NOK">
><input type="radio" name="tests[1].answer[1].responseID" value="OK">
><input type="radio" name="tests[1].answer[1].responseID" value="NOK">
>
>That is my first line on a table (All supposed to be based on tests[0] only... The 
>second row is the one supposed to be tests[1], but instead it repeats the tests[0] 
>and tests[1] the same way as the lines above...
>
>If I move the root to items, like:
><nested:iterate id="items" ...>
><nested:root name="items">
>       <nested:itearate id="tests" ...>
>
>
>               <nested:iterate id="answer" ...>
>                       <nested:radio name="answer" ...>
>               </nested:iterate>
>       </nested:iterate>
>       </nested:root>
></nested:iterate>
>
>It looks a little bit better, but items looses it's indexing as well with the same 
>behavior as above for tests...
>
>Besides if tests works properly that is enought to identify my radio groups. While 
>with the extra level for the items (output below), I don't know how the Actionform 
>will behave...
><input type="radio" name="items[0].tests[0].responses[0].responseID" value="OK">
><input type="radio" name="items[0].tests[0].responses[0].responseID" value="NOK">
><input type="radio" name="items[1].tests[0].responses[1].responseID" value="OK">
><input type="radio" name="items[1].tests[0].responses[1].responseID" value="NOK">
>
>As you can see, on the above output everything was fine IF the items[x] doesn't 
>print....
>
>Thanks,
>Marcelo.
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to