Struts2 jQuery plugin - submit button

狂风中的少年 提交于 2019-12-02 12:59:07

In order <sj:submit> to work properly targets attribute must be set to some value and form must have id attribute.

<s:form action="product!list" id="searchForm">     
  <sj:submit targets="results"/>
</s:form>

You should include <sj:head/> tag in the body of the <head>. This tag links JQuery and stylesheet on the page and other initial things, without it Ajax call has not made and as a result page refreshes. See examples of submitting tag SubmitTag:

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head/>
  </head>
  <body>
    <s:form id="form" action="AjaxTest">
      <input type="textbox" name="data">
      <sj:submit value="Submit Form" />
    </s:form>
  </body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!