Hi,
I'm using an array of SchuelerMatura-Objects in a DynaValidatorForm, being defined like this in struts-config:
<form-bean name="fachklForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="schuelerMatura" type="org.mmo.model.SchuelerMatura[]"/>
</form-bean>
I want to show and edit those elements in a table, whereas I iterate through the array as follows:
<c:forEach var="schuelerMatura" items="${fachklForm.map.schuelerMatura}" varStatus="status">
<tr>
<td><c:out value="${schuelerMatura.schueler.vorname}" /> <c:out value="${schuelerMatura.schueler.nachname}" /> </td>
<c:forEach var="schuelerMatura.fachklausuren" items="${schuelerMatura.fachklausuren}" varStatus="loopStatus">
<td><html:text indexed="true" name="schuelerMatura.fachklausuren" property="note"/></td>
</c:forEach>
<td><html:checkbox indexed="true" name="schuelerMatura" property="toChange"/></td>
</tr>
This works quite fine for schueler.*name and toChange. Fachklausuren is a Set in my SchuelerMatura-class, so I simply iterate through this Set again. (The Action makes sure that there are always three elements in it). Showing the values works fine, but when I change one of the fields from 'fachklausuren', the Action doesn't realize it, respectively the values of the elements have not changed.
I think that this is the problem (here's a sample row, showing the plain text of my page):
<tr>
<td>Max Mustermann </td>
<td><input type="text" name="schuelerMatura.fachklausuren[0].note" value=""></td>
<td><input type="text" name="schuelerMatura.fachklausuren[1].note" value="2"></td>
<td><input type="text" name="schuelerMatura.fachklausuren[2].note" value=""></td>
<td><input type="checkbox" name="schuelerMatura[0].toChange" value="on"></td>
</tr>
As you can see, the index is not included in the schuelerMatura-part of the fachklausuren-fields, so I assume it can't be mapped back after being submitted.
It's the same with
<c:forEach var="fachklausuren" items="${schuelerMatura.fachklausuren}" varStatus="loopStatus">
I'd thought about something like
<c:forEach var="schuelerMatura[${status.index}].fachklausuren" items="${schuelerMatura.fachklausuren}" varStatus="loopStatus">
for the inner forEach, which gives an exception.
Anybody can give me a hint on how to handle that?
Thanks in advance.
Kind regards, Simon
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]