struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Takhar, Sandeep" <Sandeep.Tak...@CIBC.ca>
Subject RE: Logic:iterate with html:text indexed properties
Date Thu, 15 Apr 2004 11:34:35 GMT
You can manually create the property or use nested beans.

sandeep

-----Original Message-----
From: Scherger, Derek [mailto:Derek.Scherger@encana.com]
Sent: Wednesday, April 14, 2004 5:33 PM
To: 'user@struts.apache.org'
Subject: Logic:iterate with html:text indexed properties


I'm having a bit of a problem with the html:text tag in an indexed
context... 
my form bean is arranged as follows:

FormBean
	InnerBean aaa;
	InnerBean bbb;

InnerBean 
	List list;

SimpleBean 
	String name;
	Integer value;

Where the elements of the InnerBean list are SimpleBean's. On my jsp page I
have the following, inside of and html:form tag.

<logic:iterate id="simple" name="formBean" property="aaa.list"
type="SimpleBean">
<html:text name="simple" property="value" indexed="true"/>
</logic:iterate>

The html that gets generated by this has text inputs named simple[0].value,
simple[1].value etc..
When this is submitted it's trying to set these indexed values directly on
the formBean rather than on the proper inner bean's list. i.e.
BeanUtils.populate(formBean, {simple[0].value=123, simple[1]=456})

I'm thinking of addint a getSimple(int index) method to my form bean to
return the indexed element from aaa.list but this seems like somewhat of a
hack. It seems that the html:text tag needs some way of generating inputs
with a prefix to the specified name, in my case aaa.list so that the inputs
are named "aaa.list.simple[0].value" etc.

Is there a better way to handle situations like this, or does my form bean
need to be less structured to work properly?

Thanks,
Derek






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


Mime
View raw message