1

私が使用しているwebAppを開発するために、タグstruts 2 hibernate 3の値を変更し、<s:select/>このクエリの結果を非表示の入力に渡すときにクエリを実行したいのですが、selectタグの要素を変更したときに同じページにとどまりたいです

この例のような私のページjsp戦利品:

<form  name="evalform" action="saveOrUpdateSousEval"    method="post"  >    
<s:iterator begin="1" end="4" status="status">
        <s:hidden   name="SousEval_Note"   
                value="99" 
                placeholder="entrer  Note"
                      />
        <s:select 
            headerValue="---------------- Select ---------------"
            headerKey="-1" 
            list="SousItemsListGrille"
            listKey="SousItem_ID"   
            listValue="SousItem_Libelle"
            name="sousEvalItem.SousItem_ID"  
            cssClass="selectedId"

            />

</s:iterator>   
</form> 

ここで、選択した要素のIDを取得することから始めました:

    <script type="text/javascript">
        $("#idselectdiv .selectedId").change(function () {
        var idd = $(this).val(); 
//each element selected in each select tag  has an id and i want excute query of this id  
        alert(" id selected "+idd);
        $.ajax({
        //somthing here !!
    });
    });
    </script>

ストラットで。xmli は、このアクションを定義します:

<action name="ponderation" method="getItembyPonderation"        class="action.classAction">
    <result name="success"    >/oki.jsp</result>
 </action>

私のクラスActionには、このメソッドがあります:

public Double getItembyPonderation(){
System.out.print("enter getItembyPonderation ok");
Double b = null;
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
List<Double> a=selectponder.selectponderation(Long.parseLong(request.getParameter("SousItem_ID")));
        while (a != null) {
        return  b=a.get(0);
        }
return b;
}

私のクラスでDao:

public List<Double> selectponderation(Long idsousitem){
    List<Double> valponderation = null;
    try {
    valponderation = session.createQuery("SELECT a.ponderation FROM items a, sousitems b WHERE a.Item_ID = b.Item_ID and b.SousItem_ID="+idsousitem).list();                                                                    ;
} catch (Exception e) {e.printStackTrace();}
return valponderation;
}

ここで私はそれを行うためのアイデアが必要です

4

1 に答える 1