Struts2 jQuery plugin - submit button

后端 未结 2 1072
误落风尘
误落风尘 2021-01-29 08:31

I have Struts2 jQuery plugin submit button, when click the button its not firing the action class as struts submit button. I need to keep the same page after click the button.Pl

相关标签:
2条回答
  • 2021-01-29 08:46

    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>
    
    0 讨论(0)
  • 2021-01-29 08:53

    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>
    
    0 讨论(0)
提交回复
热议问题