将 JSP 参数传递给 spring 控制器
我在 jsp 到控制器之间传递值时遇到问题..
我的 home.jsp 包含另一个文件 check.jsp..
<jsp:include page="check.html" flush="true">
<jsp:param name="param1" value="1" />
<jsp:param name="param2" value="expert" />
<jsp:param name="param3" value="skill"/>
</jsp:include>
这是控制器...
@RequestMapping(value="check", method = RequestMethod.GET)
public String checkList(ModelMap modelMap, HttpServletRequest request){
Map<String, String> map = new HashMap<String, String>();
map.put("param1",request.getParameter("param1"));
map.put("param2",request.getParameter("param2"));
map.put("param3",request.getParameter("param3"));
modelMap.addAllAttributes(map);
return "checklist";
}
但我无法获取控制器中的值..我的意思是所有参数值控制器中为空。如何获取这些值?
I am having issues with passing values between jsp to controller..
my home.jsp includes another file check.jsp..
<jsp:include page="check.html" flush="true">
<jsp:param name="param1" value="1" />
<jsp:param name="param2" value="expert" />
<jsp:param name="param3" value="skill"/>
</jsp:include>
and here is the controller...
@RequestMapping(value="check", method = RequestMethod.GET)
public String checkList(ModelMap modelMap, HttpServletRequest request){
Map<String, String> map = new HashMap<String, String>();
map.put("param1",request.getParameter("param1"));
map.put("param2",request.getParameter("param2"));
map.put("param3",request.getParameter("param3"));
modelMap.addAllAttributes(map);
return "checklist";
}
but I can't get the values in controller.. I mean all param values are null in the controller.. How to get these values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是你的参数为空的原因。
That's why your params are empty.