开发者

struts 2 dojo, can't load partial div tag?

开发者 https://www.devze.com 2023-04-11 20:17 出处:网络
Can anyone help me? I can\'t load div tag partially! The flow, I run is like that: When I click submit btn, it call imporUrl and go to action \"import\" and then call the importAction in ActionBean.

Can anyone help me? I can't load div tag partially! The flow, I run is like that:

When I click submit btn, it call imporUrl and go to action "import" and then call the importAction in ActionBean. After that set 'AAA' and 'BBB' to the List. Finally it is all working , but it reload the whole form, not only div, I want to reload only div partially. Please help thank !

<s:url id="importUrl" action="import">
<s:param name="id" value="%{id}" />
</s:url>

<sx:submit href="%{importUrl}" value="Import" targets="selectedDiv" />

String importAction(){
List.add("AAA");
List.add("BBB");
    return SUCCESS;
}

<s:div id="selectedDiv">
<s:iterator value="List">
    <s:property/>
</s:iterator>
<开发者_运维知识库;/s:div>


I think you directly load the div on same page.But you have to do like this.

<sx:submit href="%{importUrl}" value="Import" targets="selectedDiv"  
 onclick="javascript:show_details();return false;"/>

And put javascript

<script>
        function show_details() {
            dojo.event.topic.publish("show_detail");
        }
</script>

And make ur div tag like :

<sx:div id="details" listenTopics="show_detail" formId="frm_demo" showLoadingText=""> 
</sx:div>
0

精彩评论

暂无评论...
验证码 换一张
取 消