我控制器包含下面的代碼如何從春天控制器的字符串傳遞到我的JSP
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello(Model model) {
model.addAttribute("msg", "Hello world buddy");
return "helloworld";
}
我的JSP頁面
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://www.springframework.org/tags/form"
prefix="springForm"%>
<!DOCTYPE html">
<html>
<head>
<title>Spring MVC -HelloWorld</title>
</head>
<body>
<springForm:form name="hello" commandName="command" method="GET"
action="/hello">
<c:out value='${msg}' />
</springForm:form>
</body>
</html>
,但我得到的輸出
${msg}
我期待輸出「你好世界哥們」