Struts标签<s:submit>有什么区别?和 Struts jQuery 标签 <sj:submit>? [英] What's the difference between Struts tag <s:submit> and Struts jQuery tag <sj:submit>?
问题描述
Struts 标签
和 Struts jQuery 标签
都以相同的方式提交.我的意思是,他们刷新页面并转发到另一个页面.但我认为 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 标记按钮
那么它不会'工作.那么,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?
推荐答案
您可能忘记在 的正文中包含
标签;代码>.该标签将 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标签<s:submit>有什么区别?和 Struts jQuery 标签 <sj:submit>?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!