struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Gundersen" <>
Subject Collections and type conversion
Date Thu, 05 Feb 2009 12:00:12 GMT

Could anyone point out what I'm doing wrong here please? My model (FileType) has a collection
of Field objects and a getter called getFileFields(). 

I want to automatically display and set these when my form is rendered/posted. 

Rendering is easy using an iterator, but to allow the collection to be reconstructed upon
form submission, I think I need to enable type conversion. So, in the same package as my action,
I have this file:


In my JSP, I have the following 

<s:iterator id="field" value="model.fileFields" status="status">
	<s:textfield name="fieldName" size="20"/>     <%-- version 1 --%>
	<s:textfield name="fileFields(%{id}).fieldName" />	<%-- version 2 --%>

Version 1 displays OK, but because it's not indexed, when I submit the form, the model's collection
(fileFields) is not updated. 
Version 2 does not display the value (of 'fieldName') at all (although the '%{id}' value is
correctly output). And, it doesn't set the collection in my model either, although I believe
it should according to the docs. 

I've tried lots of variations on the OGNL syntax for the textfield's name attribute but can't
hit the right one; would really appreciate some help.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message