lundi 9 février 2015

How to edit an array in Form from JSTL

I have to do something and I don't know how, could you help me, please?


I have a form where there is an array of positions. Here is the code:



public class DataFieldForm implements Serializable {

private int id;

private List<Position> positions = new ArrayList<Position>();

public List<Position> getPositions() {
return positions;
}

public void setPositions(List<Position> positions) {
this.positions = positions;
}
}


... (There are more getters and setter for id I have hidden)


And now in my JSP I want to show the data contained in the array but linked to the Form so any change made bu the user would be reflected in the form, so I tried with the following:



<form:form action="${actionManageRegisteresDataFieldURL}" commandName="registeredDataForm" method="POST">

<c:forEach items="${positions}" var="position">
<div class="datosregistradoscampo-items">

<div class="datosregistradoscampo-item">

<form:input class="nuevocampoformulario-input" name="position.id" type="text" autocomplete="off" path="position.id" id="position.id" size="20" />
</div>

</div>
</c:forEach>


But it doesnt work... so I'm getting something completely wrong...


Thanks in advance.





Aucun commentaire:

Enregistrer un commentaire