boykaa 0 Newbie Poster

since three days I try to insert many record in DB , I m using struts 2 and hibernate 3.I have 3 tables:

1 Evaluationglobale (id_eval ,label)
2 SousEval(id_eval ,SousItem_ID),
3 SousItems(SousItem_ID,label)

my issue is how to insert many record in table SousEval when using the last insert id_eval in table Evaluationglobale for more explain i want do somthing like that :

table Evaluationglobale :

id_eval        label
----------------------------
1              evaluation 1

table SousItems:

SousItem_ID   SousItem_Libelle
----------------------------
1              sousitem 1
2              sousitem 2
3              sousitem 3
4              sousitem 4

i want insert somthing like that in SousEval

id_eval     SousItem_ID
----------------------------
1              1
1              2
1              3
1              4

And I don't know how to recupere all SousItem_ID from iterator from this jsp : t think that i need to increment the attribute name of <s:select> but i donnot know how.

this is my jsp :

<form  name="evalform" action="saveOrUpdateSousEval"    method="post"   style="width: 100%; margin-left: 0px;" class="evalform" id="grille"  >   
    <div   style="text-align: center; margin-top: 20px;" class="content" >   


    <s:hidden        name="souseval.SousEval_ID" />
    <s:textfield name="souseval.SousEval_Note"       placeholder="entrer  Note"/>
    <s:textfield    name="evalglb.Eval_ID"                 id="id_hidden_get_s"   placeholder="Eval_ID"/>
    <s:submit value="Evaluer"  cssClass="btnsubmit"   /> 
    <TABLE  class="EvalTable" >
            <s:iterator value="CategListGrille"  status="userStatus"  >
            <tr class="<s:if test="#userStatus.odd == true ">odd</s:if><s:else>even</s:else>">
                <td ALIGN="CENTER"  style="color: red ; font-weight: bold;" >
                        <s:property value="Catg_Libelle" />
                </td> 
                <TD ALIGN="CENTER"  >
                    <TABLE  class="EvalTable">
                    <s:iterator value="type"   status="typeStatus"  >
                        <tr class="<s:if test="#typeStatus.odd == true ">odd</s:if><s:else>even</s:else>">
                            <td ALIGN="CENTER" width="170px" >
                                <s:property value="Type_Libelle" />
                            </td>
                            <TD ALIGN="CENTER" >
                                <TABLE  class="EvalTable" >

                                <s:iterator value="item"  status="idStatus"  >
                                    <s:select 
                                            label="%{Item_Libelle}"  
                                            headerValue="---------------- Select ---------------"
                                            headerKey="-1" 
                                            list="sousitem"
                                            listKey="SousItem_ID"   
                                            listValue="SousItem_Libelle"
                                            cssClass="tdLabelwidht"                                  
                                            name="sousEvalItem.SousItem_ID"+i

                                    />
                                <%  System.out.println(i);    i++;  %>   
                                </s:iterator>
                                <div id="div1"></div>

                                </TABLE>
                            </TD>    
                        </tr>
                    </s:iterator>
                    </TABLE>
                </TD>    
            </tr>
            </s:iterator>
    </TABLE> 
    </div>   
</form>  

My class SousEvaluationDao :

public void saveOrUpdateSousEval(List<SousEvaluation> sousevalnote) {
try {
    for (Iterator<SousEvaluation> it = sousevalnote.iterator(); it.hasNext();) {
         session.saveOrUpdate(it.next());
    }
} catch (Exception e) {
    transaction.rollback();
    e.printStackTrace();
    }   
}

in myclass action:

--------

private List<SousEvaluation> sousevalnote=new ArrayList<SousEvaluation>();
private SousEvaluationDao sousevaldao=new SousEvaluationDaoImpl();
    ---
public String saveOrUpdateEval(){   
    sousevaldao.saveOrUpdateSousEvaluationNote(sousevalnote);
    return SUCCESS;
    }