如何在sj下拉列表中提交表单?

时间:2012-10-18 09:06:53

标签: jquery struts2 struts2-jquery struts2-json-plugin

我正在使用Struts 2 jquery插件的下拉列表。我想提交具有此下拉列表的表单,并希望将目标提供给其他div.please给出一些想法。提前感谢您。这是代码:

         <sj:select 
          list="dayList" 
          href="%{idDayList}"
          title="Select day"
          id="dayId" headerKey="-1"
          headerValue="-----Select Day-----" 
          targets="rightBottomDiv"/>   


<sj:div id="rightBottomDiv"  formIds="idLeftForm"  cssStyle="height:100%;width:100%;background-color:#dfdsf;"                                        draggableRevert="invalid" cssClass="accept ui-widget-content ui-corner-all" >
          <jsp:include page="templateRightBottomDiv.jsp"/>
          </sj:div>
<action name="daySubmitAction2"  method="divRefreshMethod" class="com.ebhasin.fitnessbliss.actions.templateExerciseAction">
                <result  name="success">/jsps/templateRightBottomDiv.jsp</result>
            </action>

1 个答案:

答案 0 :(得分:0)

尝试:

         <sj:select 
          list="dayList" 
          href="%{idDayList}"
          title="Select day"
          id="dayId" headerKey="-1"
          headerValue="-----Select Day-----" 
          targets="rightBottomDiv"
          onChangeTopics="somethingHappened"/>

<script>
    $.subscribe('somethingHappened', function(){
        $("your-form-selector").submit();
    });
</script> 

<强>更新

如果你有这样的行动:

<action name="daySubmitAction2"  method="divRefreshMethod" class="com.ebhasin.fitnessbliss.actions.templateExerciseAction">
    <result name="success">/jsps/templateRightBottomDiv.jsp</result>
</action>

您可以像这样轻松加载div

<s:url var="remoteUrl" action="daySubmitAction2"/>
<sj:div href="%{remoteUrl}/>