Hello all:

I am iterating over a list of products and for each
iteration I need to render a form bean with a single
text field in which a user must enter a number in
order to add the product to a shopping cart.

my form bean definition is as follows:
<form-bean name="addToCartForm"
type="org.apache.struts.validator.DynaValidatorForm">
            <form-property
                name="productId"
                type="java.lang.String"/>
                        <form-property
                name="quantity"
                type="java.lang.String"
                initial="1"/>
</form-bean>

What ends up happening in my iteration in the JSP is
that every form bean will of course have the same
name. 

So what ends up happening is that every form bean in
the page is essentially the same object. So whenever
any validation fails on the page, all the form beans
will end up having the same value when I what I really
what is for each form bean to be independent of any
other form.

What I need is a way to alias each form bean for each
product with a different name. I have tried adding
each individual form bean in the struts-config, but
what happens is that I end up getting a null when I
try to output the form bean with:

<html-form name='productForm${product.productId}'
type='org.apache.struts.validator.DynaValidatorForm'
action='/someAction'/>

...rest of form bean.

As you will notice, the name of the form bean depends
on the current product id in the iteration. I'm not
quite sure if this is the correct way to go, but I
would appreciate any comments someone might have.

Thanks in advance



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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

Reply via email to