You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Giaccone, Anthony CTR DTIC-A" <AG...@DTIC.MIL> on 2007/03/27 01:19:36 UTC

For loops in a form...


I'm totally confused.  I'm trying to create a dynamic form. I have two
different lists of beans on the page. 

In the first list (LineItems) I can change values in text fields and the
values in the beans in the list update. I can add new beans to the list
and delete beans from the list. I can also modify the values of a bean
by modifying values on the form.

The second list works partially. I can add beans to the list and delete
them. However, I can NOT change the values of fields in the beans that
are in the list.  
 


The form contains LineItems and FundCites. In each case I iterate over a
List of beans.  Here are the definitions from my page file:

	<component id="LineItemFor" type="For">
		<binding name="source" value="ognl:detailFD.lineItems"
/>
		<binding name="value" value="ognl:curLineItem" />
		<binding name="element" value="literal:tr" />
		<binding name="index" value="ognl:lineItemIndex" />
	</component>
	
	<component id="FundCiteFor" type="For">
		<binding name="source" value="ognl:detailFD.fundCites"
/>
		<binding name="value" value="ognl:curFundCite" />
		<binding name="element" value="literal:tr" />
		<binding name="index" value="ognl:fundCiteIndex" />
	</component>


Here are the definitions from the object that holds the lists:


	protected List lineItems;
	protected List fundCites;

The lists hold different types of objects. The lineItems list holds a
LineItemBn, 
the fundCites list holds a FundCiteBn. When the page is first created
there
are two items in the lineItems list and one Item in the fundCites list.

here are the accessors:

	public List getFundCites() {
		return fundCites;
	}

	public void setFundCites(List fundCites) {
		this.fundCites = fundCites;
	}
	public List getLineItems() {
		return lineItems;
	}

	public void setLineItems(List lineItems) {
		this.lineItems = lineItems;
	}

This is how the HTML is set up. first lineItems:

  <tr jwcid="LineItemFor">
    <td align="center" class="title4">
    		<span jwcid="@Insert" value="ognl:lineItemIndex" />
    		<span jwcid="@Hidden"
value="ognl:curLineItem.lineItemId" />

Then the FundCite:

  <tr jwcid="FundCiteFor">
  	<td>
  	<table>
  	<TR>
    	<td class="title4" valign="top" colspan="2">
    		Fund Cite #<span jwcid="@Insert"
value="ognl:fundCiteIndex" />
 			<span jwcid="@Hidden"
value="ognl:curFundCite.fundCiteId" />



I set a break point at pageEndRenderer after the rewind phase is
complete.  The break point is set
on the System.out

	public void pageEndRender(PageEvent event) 
	{
		DetailDataForm data =  getDetailFD();
		System.out.println("!-1-1-1-1- Page (
"+this.toString()+" ) is rendered !-1-1-1-1-1-1-1-1");
	}

At this point the beans in the lineitem list have been updated. The bean
in the FundCite has not. 
The curFundCite bean has the updated values. However the item in the
list has NOT been updated with the new values.

Can anyone give me an idea why the one list is being updated and the
second list is not?
I