Your using OM objects and stuffing them into your view but this should still work anyhow.

CreditCost newCost = new CreditCost();
creditCostList.add(newCost);

Have an add action do the above, I assume you're scoping to session as you're iterating through a scoped array/list and not a form property.

IMO you want to have things looking more like this

<logic:iterate id="item" name="costsForm" property="creditCosts">

and in your actions

CreditCostsForm theForm = (CreditCostsForm) form;

List costList = theForm.getCreditCosts();

costList.setCrediCost(costList.size(),new CreditCostForm());

Notice CreditCostForm not CreditCost from you OM, although you could get away with using CreditCost as a form property it will make life harder if you ever want to decouple the web and model tiers.

If you cant be arsed having webtier beans/forms then perhaps use a map or dynabean to do the same thing.

On 22 Mar 2004, at 08:42, Joe Hertz wrote:



I have a simple iterate in a piece of JSP (snippet follows) that provides an
interface inside of an HTML table to modify items that came out of the
database.


What I want to do is provide an extra row or two for new items to be inserted
into the database. Short of embeddeding scriptlet code to generate the
property identifiers (which are in a List), is there a good way to do this?


Basically the ideal answer would be to have a way to tell logic:iterate to go
for an extra round, with the tag being smart enough to "do the needful".


tia

-Joe

<table border=1 cellpadding=1>
<tr>
<th>Minimum Purchase</th>
<th>Cost Per Credit</th>
<th>Begin Date</th>
<th>End Date</th>
</tr>
<logic:iterate id="item" name="creditCost" indexId="index"
type="bb.hibernate.Creditprice">
<tr><td><html:hidden name="item" property="id" indexed="true" />
<html:text maxlength="5" name="item" property="minPurchase" size="5"
indexed="true" /></td>
<td><html:text maxlength="5" name="item" property="creditCost" size="5"
indexed="true" /></td>
<td><html:text maxlength="10" name="item" property="beginDate" size="10"
indexed="true" /></td>
<td><html:text maxlength="10" name="item" property="endDate" size="10"
indexed="true" /></td></tr>
</logic:iterate>



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



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



Reply via email to