搜索框Controller层代码

阅读更多
public void getGoodsList() {

try{
HttpServletRequest request = getHttpServletRequest();
Map result = new HashMap();

String data = request.getParameter("data");

Map param =  new Gson().fromJson(data, new TypeToken>() {}.getType());  //其中调用的是匿名内部类
String searchContent = (String)param.get("SEARCH_CONTENT");
param.put("SEARCH_CONTENT",searchContent.replace(" ",""));//去除客户端输入的空格
result = goodsService.getGoodsList(param);

printHttpServletResponse(GsonUtil.toJson(result));
} catch (Exception e) {
throw new IServiceException(this.getClass() + " --> getGoodsList() Exception : " + e);
}
}

你可能感兴趣的:(搜索框)