如何使用Struts2 Jquery插件实现过滤器搜索

2024-04-06

我正在尝试为我的 Struts2 jquery 网格实现过滤器搜索。如果我搜索任何字符串(通过 jquery 过滤器文本框),那么它会调用我的操作类,但我无法在我的操作类中获取搜索字符串。 我尝试在我的 Action 类中打印此行,但搜索字符串没有出现在我的 Action 类中。

System.out.println("This line is getting printed But search textbox values is not printing."+searchString+""+searchField);

请帮助我,我尝试了很多,并且仍在努力。My Code:

主题信息.jsp

            <%@ page contentType="text/html; charset=UTF-8"%>
            <%@ taglib prefix="s" uri="/struts-tags"%>
            <%@ taglib prefix="sj" uri="/struts-jquery-tags"%> 
            <%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%> 
            <html>
            <head>
            <title>Hello World</title> 
            <style type="text/css">
            @import
            url(<%=request.getContextPath()%>/css/style1.css);
            </style> 
             <sj:head jqueryui="true" jquerytheme="le-frog"/> 
            </head>
            <body> 
                <div id="setpage"> <s:url id="editurl" action="nedit"/>
                    <s:url id="editurl" action="nedit"/>
                    <s:url  id="remoteurl" action="ntable"/>

                    <sjg:grid
                       id="gridtable"
                        caption="Customer Examples"
                        dataType="json"
                        filter="true" 
                        filterOptions="{ stringResult :true, 
                        searchOnEnter : false, 
                        enableClear : true, 


                        gridModel="gridModel"
                        rowList="10,15,20"
                        navigatorDelete="true">
                    <sjg:gridColumn name="id" index="subjectId" title="ID" formatter="integer" sortable="true" key="true" 
                                       search="true" searchoptions="{sopt:['eq']}" editable="true"  hidden="true"   />

                    <sjg:gridColumn name="subjectName" index="subjectName" title="Subject Name" sortable="true" search="true"
                                        editable="true"
                                        edittype="text" />
                    </sjg:grid> 

                    </div>
            </body>
            </html>

From http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching http://www.trirand.com/jqgridwiki/doku.php?id=wiki:toolbar_searching

当 stringResult 选项设置为 true 时,发布到服务器的数据是字符串,并且发布数据的结构与高级搜索中的结构相同。

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:advanced_searching#options http://www.trirand.com/jqgridwiki/doku.php?id=wiki:advanced_searching#options

所以我认为你的问题是你正在寻找searchString,但jqgrid正在发送一个名为filters的请求变量,它是一个json字符串,如高级搜索选项链接中所述。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用Struts2 Jquery插件实现过滤器搜索 的相关文章

随机推荐