spring mvc 初级问题。
山城忙碌人 2010-08-11 11:03:47 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了。
谢谢!