Struts tag <s:submit> 有什么区别?和 Struts jQuery 标签 <sj:submit>? [英] What's the difference between Struts tag <s:submit> and Struts jQuery tag <sj:submit>?

查看:19
本文介绍了Struts tag <s:submit> 有什么区别?和 Struts jQuery 标签 <sj:submit>?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Struts 标签 <s:submit> 和 Struts jQuery 标签 <sj:submit> 都以相同的方式提交.我的意思是,他们刷新页面并转发到另一个页面.但我认为 Struts jQuery 标签实现了 Ajax,所以页面在提交时不应该改变.我说的对吗?

Struts tag <s:submit> and Struts jQuery tag <sj:submit> both submit in the same way. I mean, they refresh the page and forward to another to page. But I thought Struts jQuery tag implemented Ajax so the page should not be change while submitting. Am I correct?

我已经在表单中实现了两个标签,同时提交两者的工作方式相同.

I have implemented both tags in form, while submitting both are working same way.

<s:form action="part!list" >
  <s:submit  action="part" method="list" />
</s:form>

<s:form action="part!list" >
  <sj:submit />
</s:form>

如果我使用 <sj:submit> 它可以工作,但是我添加了一些 struts 标记按钮 <s:submit> 以相同的形式然后它没有不工作.那么,Struts 标签就不行了?

If I use <sj:submit> it works, but I add some struts tag button <s:submit> in the same form then it doesn't work. So, Struts tag won't work?

推荐答案

你可能忘记在 <head> 的正文中包含 <sj:head/> 标签;.此标记将 JQuery stylesheet 链接到页面和其他初始内容,没有它就不会进行 Ajax 调用.查看正确提交 SubmitTag 的示例.

You have probably forgot to include <sj:head/> tag in the body of the <head>. This tag links JQuery stylesheet onto the page and other initial things, without it Ajax call is not made. See examples of correct submitting SubmitTag.

如果您通过 <sj:submit> 进行 Ajax 调用,页面不应刷新,但 targets 可能会在成功结果后更新.如果页面头部没有包含 JQuery,我认为表单不会发出任何 HTTP 请求,它的行为就像你没有包含 action 属性一样.

If you make an Ajax call via <sj:submit> the page should not refresh but the targets could be updated on successful result. If didn't include JQuery in the head of the page I don't think the form make any of the HTTP requests, it's behaving like you are not included the action attribute.

这篇关于Struts tag &lt;s:submit&gt; 有什么区别?和 Struts jQuery 标签 &lt;sj:submit&gt;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆