action疑问
//分页查询 @RequestMapping(params="method=prefindByPage")
public ModelAndView prefindByPage(Student stu, HttpServletRequest request, HttpServletResponse response){
System.out.println(stu.getSt_name());
Map<String,Object> mapValue = new HashMap<String,Object>();
mapValue.put("st_name", stu.getSt_name());
mapValue.put("st_tel",stu.getSt_tel());
mapValue.put("invite", stu.getInvite());
mapValue.put("st_QQ", stu.getSt_QQ());
mapValue.put("st_wechat", stu.getSt_wechat());
mapValue.put("St_purpose", stu.getSt_purpose());
String sTime = request.getParameter("consultTimeStart");
mapValue.put("consultTimeStart", sTime);
String eTime = request.getParameter("consultTimeEnd");
mapValue.put("consultTimeEnd", eTime);
List rows = this.getStudentService().findByPage("student.prefindByPage", mapValue);
int totalRows = rows.size();//查询总记录数(8个条件)
PageBean pageBean = PagerHelp.getPager(request, totalRows);
Map<String,Object> map = new HashMap<String,Object>();
map.put("pageSize", pageBean.getPageSize());
map.put("currentPage", pageBean.getCurrentPage());
map.put("st_name", stu.getSt_name());
map.put("st_tel",stu.getSt_tel());
map.put("invite", stu.getInvite());
map.put("st_QQ", stu.getSt_QQ());
map.put("st_wechat", stu.getSt_wechat());
map.put("St_purpose", stu.getSt_purpose());
String startTime = request.getParameter("consultTimeStart");
map.put("consultTimeStart", startTime);
String endTime = request.getParameter("consultTimeEnd");
map.put("consultTimeEnd", endTime);
List list = this.getStudentService().findByPage("student.findByPage", map);
request.setAttribute("stuList",list);
request.setAttribute("pageBean",pageBean);
request.setAttribute("stu",stu);
request.setAttribute("purpose", stu.getSt_purpose());
request.setAttribute("consultTimeStart",startTime);
request.setAttribute("consultTimeEnd",endTime);
return new ModelAndView("studentInfo/consult_studentInfo_visit");
}
@RequestMapping(params="method=findByPage")
public ModelAndView findByPage(Student stu, HttpServletRequest request, HttpServletResponse response) throws Exception{
System.out.println(stu.getSt_name());
Map<String,Object> mapValue = new HashMap<String,Object>();
String zd = request.getParameter("st_name");
zd = new String(zd.getBytes("ISO-8859-1"),"UTF-8");
stu.setSt_name(zd);
mapValue.put("st_name",stu.getSt_name());
mapValue.put("st_tel",stu.getSt_tel());
String zd1 = request.getParameter("invite");
zd1 = new String(zd1.getBytes("ISO-8859-1"),"UTF-8");
stu.setInvite(zd1);
mapValue.put("invite", stu.getInvite());
mapValue.put("st_QQ", stu.getSt_QQ());
String zd2 = request.getParameter("st_wechat");
zd2 = new String(zd2.getBytes("ISO-8859-1"),"UTF-8");
mapValue.put("st_wechat", stu.getSt_wechat());
String zd3 = request.getParameter("St_purpose");
zd3= new String(zd3.getBytes("ISO-8859-1"),"UTF-8");
stu.setSt_purpose(zd3);
mapValue.put("St_purpose", stu.getSt_purpose());
String sTime = request.getParameter("consultTimeStart");
mapValue.put("consultTimeStart", sTime);
String eTime = request.getParameter("consultTimeEnd");
mapValue.put("consultTimeEnd", eTime);
List rows = this.getStudentService().findByPage("student.prefindByPage", mapValue);
int totalRows = rows.size();//查询总记录数(8个条件)
PageBean pageBean = PagerHelp.getPager(request, totalRows);
Map<String,Object> map = new HashMap<String,Object>();
map.put("pageSize", pageBean.getPageSize());
map.put("currentPage", pageBean.getCurrentPage());
map.put("st_name", stu.getSt_name());
map.put("st_tel",stu.getSt_tel());
map.put("invite", stu.getInvite());
map.put("st_QQ", stu.getSt_QQ());
map.put("st_wechat", stu.getSt_wechat());
map.put("St_purpose", stu.getSt_purpose());
String startTime = request.getParameter("consultTimeStart");
map.put("consultTimeStart", startTime);
String endTime = request.getParameter("consultTimeEnd");
map.put("consultTimeEnd", endTime);
List list = this.getStudentService().findByPage("student.findByPage", map);
request.setAttribute("stuList",list);
request.setAttribute("pageBean",pageBean);
request.setAttribute("ConsultStudent",stu);
request.setAttribute("purpose", stu.getSt_purpose());
request.setAttribute("consultTimeStart",startTime);
request.setAttribute("consultTimeEnd",endTime);
return new ModelAndView("studentInfo/consult_studentInfo_visit");
}
这是一个分页时用到的,点击查询调用第一个方法,点击翻页调用第二个方法,但是为何第一个方法里面传递的对象就是正常值,而第二个方法传递的值却需要转换,否则传到后台就变成乱码了,有点想不通