Hi I want to submit my form using struts2 hibernate 3
who contain nested iterator but I can't diference between all attribute name
i m trying to use a global variable in my jsp lik that :
<% int i=0; %>
<form name="evalform" action="saveOrUpdateSousEval" method="post" >
<s:iterator value="CategListGrille" status="catgStatus">
<s:iterator value="type" status="typeStatus">
<s:iterator value="item" status="itemstatus" >
<s:textfield value="66" name="%{'souseval[#i].SousEval_Note'}" />
<% i++; %>
</s:iterator>
</s:iterator>
</s:iterator>
<s:submit value="Evaluer" cssClass="btnsubmit" />
</div>
</form>
in my class Action i have this :
private ArrayList<SousEvaluation> souseval= new ArrayList<SousEvaluation>();
public String saveOrUpdate(){
System.out.println("enter saveOrUpdateEvalNote ok");
sousevaldao.saveOrUpdateSousEvaluation(souseval);
return SUCCESS;
}
and in my class Dao i have :
@Override
public void saveOrUpdateSousEvaluationNote(ArrayList<SousEvaluation> sousevalnote) {
try {
for (Iterator<SousEvaluation> it = sousevalnote.iterator(); it.hasNext();) {
session.saveOrUpdate(it.next());
}
} catch (Exception e) {
transaction.rollback();
e.printStackTrace();
}
}
my goal is to submit many obect at once using my form
I can submit many record at once when i only use one iterator like that : i make this exmape i's work fine
<form action="saveOrUpdateSousEval" method="post" >
<s:iterator begin="1" end="2" status="status">
<s:textfield name="%{'souseval['+#status.index+'].SousEval_Note'}" />
<s:textfield name="%{'souseval['+#status.index+'].evalglb.Eval_ID'}" />
<s:textfield name="%{'souseval['+#status.index+'].sousEvalItem.SousItem_ID'}" />
</s:iterator>
<s:submit value="Evaluer" cssClass="btnsubmit" />
</form>