I added the <nested:root/> tag i.e., <html:form action="/PriceQuote.do"> <nested:root name="priceQuoteForm"> <nested:nest property="firstLob"> <nested:iterate id="customer" property="customers" type="com.example.domain.pricing.Customer"> <nested:text indexed="true" name="customer" property="cost" styleClass="pq_currency"/> </nested:iterate> </nested:nest> </nested:root> </html:form>
It doesn't seem to have made any difference. I still get "customer[0].cost" instead of "firstLob.customer[0].cost". Is there something else I'm missing? Something I need to configure? Do I need to upgrade from 1.3.5 to 1.3.8? On 4/20/07, Will Budreau <[EMAIL PROTECTED]> wrote:
You need to set the form as the root nesting context. I usually do this by wrapping the nested form content with <nested:root name="myForm"> </nested:root> In theory the nested taglib is supposed to override html:form to automatically set the root node, but I haven't got that to work. -----Original Message----- From: David Conrad [mailto:[EMAIL PROTECTED] Sent: Friday, April 20, 2007 1:43 PM To: Struts Users Mailing List Subject: List of beans in a bean on a form I'm using Struts 1.3.5 and have a problem with a nested field. <html:form action="/PriceQuote.do"> <nested:nest property="firstLob"> <nested:iterate id="customer" property="customers" type="com.example.domain.pricing.Customer"> <nested:text indexed="true" name="customer" property="cost" styleClass="pq_currency"/> </nested:iterate> </nested:nest> </html:form> The <nested:text/> tag is outputting: <input type="text" name="customer[0].cost" value="0.0" class="pq_currency"> The problem is, the customers come from the customers collection on the firstLob object, which is a java bean on the form bean. Doesn't this need to be either "firstLob.customer[0].cost" in order for the form bean to get populated when I post it back? Right now, it isn't working. It populates the form okay when generating the page, but just ignores the customer fields (cost is just one of them) when I post it back. I just switched to using nested tags. I was hoping that it would fix it, but no such luck. Originally, I was using <logic:iterate/> and <html:text/>, but that produced the same results. (After reading a bit, I think I understand why; nested is just for convenience, right, kind of like a "with" statement in certain languages?) I suspect I'm thinking about this wrong, somehow. Maybe I need to be putting nested form beans on my form bean, instead of plain ol' java beans? Maybe I need a different syntax on my Struts tags, like name="firstLob.customer" (that doesn't work, though)? Maybe I'm trapped in a maze of twisty little passages, all alike? Please help this newbie, any suggestions at all will be greatly appreciated. David Conrad --------------------------------------------------------------------- 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]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]