Reputation: 2094
I have a simple use case
<div id="contentDiv">
<!-- This does not work -->
<div id="frmDiv">
<s:form action="..">
<s:a target="contentDiv" theme="ajax">Reload</s:a>
</s:form>
</div>
<!--This works -->
<div id="listDiv">
<s:a target="frmDiv" theme="ajax" someaction >Click Me</s:a>
</div>
</div>
I have noticed when a target of a link which is within the same target then this ajax action does not work. While when target of link is outside the div this works as required.
Any workaround to reload same div or set it as target for ajax result.
I am using struts 2.0.14
Also here instead of link if I use button this does not work. Any work-around will be appreciated.
Upvotes: 1
Views: 1419
Reputation: 10458
Just use html when it makes sense. Also using ajax witout tag libraries is probably the faster way in the long run. They are great for templates and simple logic but as client side needs become more demanding they quickly fail.
You should upgrade the application, it is highly unlikely anything would break and you get some new features. It's possible the issue you are experiencing does not exist. Have not tested it but the tag library has had a number of improvements and fixes since that version.
<a href="#first">link to first</a>
<a href="#second">link to second</a>
<!-- following weird ognl was used because you are at version 2.0.14, you should upgrade then I could have used the begin and end attributes, like in c:forEach-->
<s:iterator value="(84).{ #this }" >
<br/>
</s:iterator>
<div id="first">
This is first.
</div>
<s:iterator value="(84).{ #this }" >
<br/>
</s:iterator>
<div id="second">
This is second
</div>
Upvotes: 2