解决方案
使用jquery的方法来监听用户输入的内容的改变,然后提交到后台
下面是具体的代码
$('searchContent').bind('input propertychange',function(){
});
上面的方法是用来时时监听用户的输入,然后再调用jque$('searchContent').bind('input propertychange',function$.ajax{
type:'POST',
url:'<%=basePath%>system/searchAction_search.do',
data:{searchKey:$(this).val()},
dataType:'json',
timeout:5000,
success:function(data){
//获取服务器端回响的数据
}
}
);在服务器端获取得到异步提交的数据
public String search(){
String searchValue = (String)request.getAttribute("searcheKey");
System.out.println(searchValue);
return null;
}
通过上面的代码就可以在服务器中截取得到用户提交的数据,到索引库或者是数据库中搜索内容。