我在spring 3 mvc中有映射问题。一般我必须“发送”值(@RequestMapping(value =“/ *”)到我的return语句。它如何解决?我在想这个:
@RequestMapping(value = "/*", method = RequestMethod.GET)
public String homeForm( Model model, HttpServletResponse response) throws IOException {
logger.info("Welcome ");
String url=response.getWriter().toString();
return url;
}
这是好的解决方案,也许有人有任何建议吗? Thaks
答案 0 :(得分:0)
如果要返回斜杠后面的字符串,可以执行以下操作:
@RequestMapping(value = "/{foo}", method = RequestMethod.GET)
public @ResponseBody String homeForm(@PathVariable("foo") String foo) {
return foo;
}