简体   繁体   English

与提交struts 2和jQuery网格冲突

[英]conflict with submit struts 2 and jquery grid

I'm trying to use a Jquery Grid, in which gridModel is the result of a submit button of struts 2. But the problem is that the submit button didn't work when I add the grid in my jsp. 我正在尝试使用Jquery Grid,其中gridModel是struts 2的提交按钮的结果。但是问题是,当我在jsp中添加网格时,提交按钮不起作用。 I whould like to know if submit button have a problem with jquery grid. 我想知道提交按钮是否与jquery网格有关。

This is my jsp: 这是我的jsp:

<s:form>
..................
<s:submit name="search" onclick="submitForm()"/>

<s:url id="remoteurl" action="jsontable"/>
<sjg:grid
    id="gridtable"
    caption="Listes "
    dataType="json"
    href="%{remoteurl}"
    pager="true"
    gridModel="gridModel"
    rowList="10,15,20"
    rowNum="15"
    rownumbers="true"
>
<sjg:gridColumn name="name" index="name" title="Name"  />
<sjg:gridColumn name="age" index="age" title="Age"/>
<sjg:gridColumn name="adress" index="adress" title="Adress" />
<sjg:gridColumn name="tel" index="tel" title="Tel"   />
</sjg:grid>
</s:form>

You must set the Struts action you're expecting to call either in the s:form or s:action tags (see http://struts.apache.org/2.2.3/docs/submit.html and http://struts.apache.org/2.2.3/docs/form.html ). 您必须在s:form或s:action标签中设置希望调用的Struts操作(请参阅http://struts.apache.org/2.2.3/docs/submit.htmlhttp:// struts .apache.org / 2.2.3 / docs / form.html )。

In the code snippet you show there isn't an action defined. 在代码片段中,您显示未定义任何操作。 And, unless it's an ajax call, you don't need the onClick attribute (otherwise it would be useful to show us what does the submitForm method do). 而且,除非是ajax调用,否则您不需要onClick属性(否则,向我们展示commitForm方法的作用将很有用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM