【发布时间】:2017-09-13 17:40:13
【问题描述】:
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String helloForm()
{
return "helloform";
}
@RequestMapping(value = "/hello", method = RequestMethod.POST)
public String hello(HttpServletRequest request,Model model) {
String name = request.getParameter("name");
if (name == null) {
name = "world";
}
// do what you want to code....
model.addAttribute("message",HelloMessage.getMessage(name));
// return "<h1>" + HelloMessage.getMessage(name) + "</h1>";
return "hello";
}
【问题讨论】:
-
但我希望返回类型为响应,例如:Public response abc(){...ret response} 帮我解决这个问题。