You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Juan Alvarado <ju...@yahoo.com> on 2004/07/19 17:13:13 UTC

nested tags and bean population

In my form bean I have an array list called categories that contains objects of type Category. Each Category object contains an array list of Steps.
 
So in my jsp I am rendering this relation as follows:
 
<nested:iterate indexId='idx' name='auditmaster' property='categories' id='cat' type='com.securance.vo.ApStepCategoryVO'>
                <h3><nested:write property='category'/></h3>
    <br>
    <nested:iterate name='cat' property='steps' id='step' type='com.securance.vo.ApStepVO'>
                  <nested:textarea property='step' cols='65' rows='2'/><br>
    </nested:iterate>
   </nested:iterate>
 
First I iterate through the Category array list and then for each Category I iterate through the steps array list in each category. This renders just fine. The problem is that when a user edits each step and submits the form, only the stesp for the first Category get updated. The rest remain unchanged. I need for the user to be able to edit everything and then submit the form and have the edits be reflected in this nested relationship.
 
Thanks in advance

		
---------------------------------
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!

Re: nested tags and bean population

Posted by Juan Alvarado <ju...@yahoo.com>.
Hey Rick I got rid of the name and type and it worked. Kinda weird.
 
Thanks for the quick reply!!!
 
Later...

Rick Reumann <st...@reumann.net> wrote:
Juan Alvarado wrote:

> In my form bean I have an array list called categories that contains
> objects of type Category. Each Category object contains an array list
> of Steps.
> 
> So in my jsp I am rendering this relation as follows:
> 
> > property='categories' id='cat'
> type='com.securance.vo.ApStepCategoryVO'> > property='category'/>
> property='steps' id='step' type='com.securance.vo.ApStepVO'> 
> 

> 
> 
> First I iterate through the Category array list and then for each
> Category I iterate through the steps array list in each category.
> This renders just fine. The problem is that when a user edits each
> step and submits the form, only the stesp for the first Category get
> updated. The rest remain unchanged. I need for the user to be able to
> edit everything and then submit the form and have the edits be
> reflected in this nested relationship.

Hey Juan. What does the source code look like?

I think the source code will reveal a lot. Are you sure your collections 
aren't getting pulled from some other scope other than the form bean?

Also I never use "name" or the "type" in my nested:iterate loops. I 
think that could be the problem. If you use name it will look for that 
'name' of the collection in scope. You want to make sure you are using 
the collection that is nested inside of the other one. If you remove 
name and type and it still doesn't work that will reveal a lot of the 
problem.

For example if you have a Collection of "categories" (of 
ApStepCategoryVO) in you form bean you should be able to do











-- 
Rick

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


		
---------------------------------
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

Re: nested tags and bean population

Posted by Rick Reumann <st...@reumann.net>.
Juan Alvarado wrote:

> In my form bean I have an array list called categories that contains
> objects of type Category. Each Category object contains an array list
> of Steps.
> 
> So in my jsp I am rendering this relation as follows:
> 
> <nested:iterate indexId='idx' name='auditmaster'
> property='categories' id='cat'
> type='com.securance.vo.ApStepCategoryVO'> <h3><nested:write
> property='category'/></h3> <br> <nested:iterate name='cat'
> property='steps' id='step' type='com.securance.vo.ApStepVO'> 
> <nested:textarea property='step' cols='65' rows='2'/><br> 
> </nested:iterate> </nested:iterate>
> 
> First I iterate through the Category array list and then for each
> Category I iterate through the steps array list in each category.
> This renders just fine. The problem is that when a user edits each
> step and submits the form, only the stesp for the first Category get
> updated. The rest remain unchanged. I need for the user to be able to
> edit everything and then submit the form and have the edits be
> reflected in this nested relationship.

Hey Juan. What does the source code look like?

I think the source code will reveal a lot. Are you sure your collections 
aren't getting pulled from some other scope other than the form bean?

Also I never use "name" or the "type" in my nested:iterate loops. I 
think that could be the problem. If you use name it will look for that 
'name' of the collection in scope. You want to make sure you are using 
the collection that is nested inside of the other one. If you remove 
name and type and it still doesn't work that will reveal a lot of the 
problem.

For example if you have a Collection of "categories" (of 
ApStepCategoryVO) in you form bean you should be able to do

<nested:iterate property='categories' id='cat' >
     <h3><nested:write property='category'/></h3>
     <br>
     <nested:iterate  property='steps' id='step'>
         <nested:textarea property='step' cols='65' rows='2'/><br>
     </nested:iterate>
</nested:iterate>

-- 
Rick

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