Don't know if this e-mail went the first time... sorry if duplicated...

Once again... we're almost there...

regarding your concern, yes - the beanRefName has a getter on my ActionForm...

so I added the <nested:nest property="beanRefName"> and removed the <nested:root>

now I get the action form name INDEXED on my properties and the beanRefName is ok...

<nested:nest property="beanRefName">
<nested:iterate property="items">
        <nested:itearate property="tests">
                <nested:iterate property="answer">
                        <nested:radio property="radio">
                </nested:iterate>
        </nested:iterate>
</nested:iterate>

Note there's no <nested:root anymore...
with that I get...

actionForm[0].beanRefName.items[0].tests[0].answer[0].radio

See that beanRefName is fixed now? without a index... but what about the actionform 
indexed at the beggining?

If I add a <nested:root, the beanRefName becomes indexed again... (without the 
actionForm at least...)

Any comments? 



On Thu, 14 Mar 2002 12:25:55 -0500
Arron Bates <[EMAIL PROTECTED]> wrote:

> Marcelo,
> 
> Excellent! You're only one step away from taking over the world... :)
> 
> For properties that aren't collections, use the <nested:nest> tag 
> instead of the the <nested:iterate> tag. It represents logical steps in 
> the nested hierarchy, that aren't collections.
> 
> For example, say for every monkey that works at the plantation, they 
> each have an adress, but all address information is in another address 
> bean. The markup would look like thus...
> 
> <nested:iterate property="monkeys">
>   <nested:nested property="address">
>     <nested:text property="streetAddress" /><br>
>     <nested:text property="state" /><br>
>     <nested:text property="postalCode" /><br>
>   </nested:nest>
> </nested:iterate>
> 
> ...there's a list of monkeys, but only one address for each monkey.
> Your instance is the otherway, but same theory. One nested bean that 
> will lead to a collection.
> 
> What does confuse me a little is that the beanRefName on the start of 
> the nested property. The name of the bean itself should not be there, 
> only the properties of the things that you're trying to manipulate under
> it.
> 
> I'm assuming that the bean you want to get at is returned by a getter 
> method inside your Struts bean?...
> 
> If it is, just change that tag and you should be on your way.
> 
> Arron.
> 
> 
> Marcelo Caldas wrote:
> 
> >Thanks Aaron, your email was very helpful...
> >
> >I follow all your tips and it looks much better now...
> >following your example bellow, which is pretty much what I've got so
> far, I have all properties indexed. Actually I have too many properties
> indexed...
> >from:
> >
> ><nested:root name="beanNameRef">
> ><nested:iterate property="items">
> >     <nested:itearate property="tests">
> >             <nested:iterate property="answer">
> >                     <nested:radio property="radio">
> >             </nested:iterate>
> >     </nested:iterate>
> ></nested:iterate>
> ></nested:root>
> >
> >It's generating:
> ><input type="radio"
> name="beanNameRef[0].items[0].tests[0].answer[0].radio ...>
> >
> >where the beanNameRef index follows the same index for answers, which
> is wrong (I could ignore the index when
> >the actionForm is called with getBeanNameRef(index) and always return
> the same object... ) But it looks like
> >is not the way is sopposed to work...
> >
> >What I really want is
> >
> ><input type="radio" name="beanNameRef.items[0].tests[0].answer[0].radio
> ...>
> >or
> ><input type="radio" name="items[0].tests[0].answer[0].radio ...>
> >
> >
> >I can achieve the second output, with the problem that the index for
> items will be wrong, following the same index as answers and tests will
> have the correct index...
> >
> >
> >It seems to me that the correct answer is the first output, where
> beanNameRef is part of the name (since all the items belongs to
> beanNameRef, but I have ONE beanNameRef only... not a collection of
> them...
> >
> >Again,
> >Thanks for your help,
> >
> >Marcelo.
> >
> >
> >On Thu, 14 Mar 2002 03:15:37 -0500
> >Arron Bates <[EMAIL PROTECTED]> wrote:
> >
> >>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]>
> >>
> >
> >--
> >To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>

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

Reply via email to