RT@Controller
@RequestMapping("/index.htm")
public class Test{
@RequestMapping(params = "method=herfMethod")
public String fromMethod(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String name = request.getParameter("name");
String word = request.getParameter("word");
request.setAttribute("hello", name+","+word);
return "index";
}
}为什么我自己定义的方法,里面放HttpServletRequest request,HttpServletResponse response这两个对象,直接就能拿来用,在这里我还可以用其它的对象吗?是不是注解了@RequestMappin后就能直接用request,response了。
谢谢!
@RequestMapping("/index.htm")
public class Test{
@RequestMapping(params = "method=herfMethod")
public String fromMethod(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String name = request.getParameter("name");
String word = request.getParameter("word");
request.setAttribute("hello", name+","+word);
return "index";
}
}为什么我自己定义的方法,里面放HttpServletRequest request,HttpServletResponse response这两个对象,直接就能拿来用,在这里我还可以用其它的对象吗?是不是注解了@RequestMappin后就能直接用request,response了。
谢谢!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货