I'm trying to do that
- Getting a List of Objects from db in my action ( OK)
- Printing it on JSP (OK)
- This list come out as an editable table in JSP.. I want to modify then submit it back to the same action to save it on my db (FAIL. when i call my method with an
<s:submit action="myaction" method="mymethod">
the list i had previously populated from db now is null.How can i solve that?
i found some topic talking about a struts2 interceptor to inject data in myaction
with reflection.
public class CurrentOra {
private int idCommessa;
private String descrizioneCommessa;
private int idCliente;
private String descrizioneCliente;
private List<OreTimesheetGiorno> orePerCommessa;
public int getIdCommessa() {
return idCommessa;
}
}
and
public class OreTimesheetGiorno {
private int numeroGiorno;
private OreTimesheet oreTimesheet;
public int getNumeroGiorno() {
return numeroGiorno;
}
public void setNumeroGiorno(int numeroGiorno) {
this.numeroGiorno = numeroGiorno;
}
public OreTimesheet getOreTimesheet() {
return oreTimesheet;
}
public void setOreTimesheet(OreTimesheet oreTimesheet) {
this.oreTimesheet = oreTimesheet;
}
}
this is my object structure , and in the JSP i print it with
<s:iterator value="listOre" >
<tr class="giornoSettimana giornoUno">
<td><s:property value="descrizioneCliente"/></td>
<td><s:property value="descrizioneCommessa"/></td>
<s:iterator value="orePerCommessa">
<td>
<input type="text"
class="oreConsuntivazione"
maxlength="2"
giorno = "<s:property value="numeroGiorno" />"
value="<s:property value="oreTimesheet.numeroOre" />">
</td>
</s:iterator>
</tr>
</s:iterator>
basically I need to iterate to show customers and for each customer the hour worked on it. Then I should have the possibility to edit each hour and save it back to DB