I have some trouble when trying updating some data, I'm facing some exceptions...
I read that Struts 2 nesting iterators and applied modifications, but it does not work...
Here's Java classes :
public class Epreuveevb implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int idEpreuve;
private String nom;
private int coef;
private int note;
private int idExamen;
/* all setters and getters */
Then the second :
public class Examenevb implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int idJury;
private String nom;
private String prenom;
private List<Epreuveevb> listeEpreuves = null;
/* all setters and getters */
Finally, this is the highest class (with servlets) :
public class Saisie extends ActionSupport {
static final Logger log = LogManager.getLogger(Saisie.class);
private int idJury;
private Jury leJury;
private List<Examenevb> lesExamens;
[...]
public List<Examenevb> getLesExamens() {
return lesExamens;
}
public void setLesExamens(List<Examenevb> lesExamens) {
this.lesExamens = lesExamens;
}
And now JSP :
<s:form theme="simple" action="relevernote">
<table class="notation">
<tbody>
<s:iterator value="lesExamens" status="examstat">
<tr>
<td class="default"><span class="gras">${nom}</span>, ${prenom}</td>
<s:iterator value="listeEpreuves" status="eprstat">
<td>
${nom}<br/>
<s:textfield name="lesExamens[%{#examstat.index}].listeEpreuves[%{#eprstat.index}].note"/>
<p> </p>
</td>
</s:iterator>
</tr>
</s:iterator>
</tbody>
</table>
<p> </p>
<p class="center"><s:submit value="Valider"/></p>
</s:form>
All is fine, all marks are correctly in text fields. For eg, this is final HTML page:
<td class="default"><span class="gras">EL MORABIT</span>, MOHAMED</td>
<td>
Maths<br/>
<input type="text" name="lesExamens[0].listeEpreuves[0].note" value="0" id="relevernote_lesExamens_0__listeEpreuves_0__note"/>
<p> </p>
</td>
But when submitting, I see in log :
2017-05-16 17:29:44,910 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor [notifyDeveloperParameterException] Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'lesExamens[0].listeEpreuves[0].note' on 'class evb.pg.notation.Saisie: Error setting expression 'lesExamens[0].listeEpreuves[0].note' with value ['0', ]
2017-05-16 17:29:44,914 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor [notifyDeveloperParameterException] Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'lesExamens[0].listeEpreuves[1].note' on 'class evb.pg.notation.Saisie: Error setting expression 'lesExamens[0].listeEpreuves[1].note' with value ['0', ]
What's going wrong ? Any idea ?
I checked several times setters/getters, all is fine...