easyui url 参数传递 及 实现查询指定信息返回前端界面 问题

1、实现功能:有一个findByStudentNum.jsp,一个showfindByStudentNum.jsp,控制类中有一个findByStudentNum()方法。我现在想通过点击findByStudentNum.jsp将输入的studentnum,作为控制类中findByStudentNum()方法中(baseService.findByStudentNum(studentnum))的参数,然后将查询结果以JSON.toJSONString(map)返回给showfindByStudentNum.jsp中的url将其显示出来。2、我目前的思路:将findByStudentNum.jsp中的studentnum提交到showfindByStudenNum.jsp中,然后在showfinByStudentNum.jsp中获取studentnum并将其传递给控制类中的findByStudentNum方法中作为(baseService.findByStudentNum(studentnum))的参数,然后执行查询并将结果以JSON.toJSONString(map)返回给showfindByStudentNum.jsp中的url将其显示出来。但是不清楚如何将参数从findStudentum.jsp传递到showfindstuden.jsp中,然后将参数传递到控制类中的findByStudentnum()方法中作为查询参数。结合我提供的代码,烦请解惑。如果我上述思路有误,还望指出正确思路加具体实现,不胜感谢!下列配图一次为:(1)findByStudentNum.jsp(2)showfindByStudentNum.jsp(3)控制类中的findByStudentNum()方法

如何将参数studentNum从findStudentum.jsp传递到showfindstuden.jsp中?
如何将showfindstuden.jsp页面中的参数studentNum传递到控制类中的findByStudentnum()方法中作为参数查询,并返回JSON数据?
问题1解答,将参数从findStudentum.jsp传递到showfindstuden.jsp中有多种方式,如JS跳转传参、SpringMvc跳转传参等等
这里主要说后者,前者不安全。

思路:findStudentum.jsp中的action先请求控制类中的某个方法,如toShowfindstuden,之后方法内部接收参数,
并携带参数进行转发至showfindstuden.jsp视图中。注意!而不是showfindstuden.jsp
如下:
<form action="toShowfindstuden" method="post">
<!-- 此处省略...... -->
</form>

@RequestMapping(value = "toShowfindstuden")
public String toShowfindstuden(HttpServletRequest request, String studentNum, ModelMap model) {
model.put("studentNum", studentNum);//将studentNum作为参数携带至showfindstuden.jsp
return "showfindstuden";//这里如何编写视图地址,需要根据你自己的配置去编写
}

问题2解答,将上层传递过来的参数进行接收,并作为datagrid所请求url的参数,向后台findByStudentnum()传入。
之后进行查询并返回数据。
返回数据时注意,若要返回JSON数据,需要在方法级别上添加@ResponseBody注解。

这样,如果顺利的话,就能正常传递并接收展示数据至datagrid了,祝你成功!
温馨提示:答案为网友推荐,仅供参考