Struts2 Div Ajax 重新加载
我有一个简单的用例,
<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>
我注意到当链接的目标位于同一目标内时,此 ajax 操作不起作用。当链接目标位于 div 之外时,这将按要求工作。
重新加载相同 div 或将其设置为 ajax 结果目标的任何解决方法。
我正在使用 struts 2.0.14
Also here 而不是链接,如果我使用按钮,这不起作用。任何解决方法将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当有意义的时候才使用 html。从长远来看,使用没有标签库的 ajax 可能是更快的方法。它们非常适合模板和简单的逻辑,但随着客户端需求变得更加苛刻,它们很快就会失败。
您应该升级应用程序,任何东西都不太可能损坏,并且您会获得一些新功能。您遇到的问题可能并不存在。尚未对其进行测试,但自该版本以来,标签库已进行了许多改进和修复。
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.