如何使用Struts2 Jquery插件实现过滤器搜索
我正在尝试为我的Struts2 jquery网格实现过滤器搜索。如果我搜索任何字符串(通过jquery筛选器文本框),那么它将调用我的action类,但我无法在action类中获取搜索字符串。 我试图在Action类中打印这一行,但搜索字符串没有出现在Action类中如何使用Struts2 Jquery插件实现过滤器搜索,struts2,struts2-jquery,jqgrid,Struts2,Struts2 Jquery,Jqgrid,我正在尝试为我的Struts2 jquery网格实现过滤器搜索。如果我搜索任何字符串(通过jquery筛选器文本框),那么它将调用我的action类,但我无法在action类中获取搜索字符串。 我试图在Action类中打印这一行,但搜索字符串没有出现在Action类中 System.out.println("This line is getting printed But search textbox values is not printing."+searchString+""+search
System.out.println("This line is getting printed But search textbox values is not printing."+searchString+""+searchField);
请帮帮我,我试了很多,现在还在努力。。
我的代码:
Subjectinfo.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>
你好,世界
@进口
url(/css/style1.css);
从
当stringResult选项设置为true时,发布到服务器的数据是一个字符串,并且发布数据的结构与高级搜索中的相同
所以我认为您的问题在于您正在查找searchString,但是jqgrid正在发送一个名为filters的请求变量,这是一个json字符串,如advanced search options链接中所述