0
我在創建spring
mvc
項目面臨的問題上,如下預期我JSP
頁面不會被渲染爲代碼彈簧模型對象不是撕心裂肺的jsp頁面
我控制器
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HelloController {
@RequestMapping("/welcome")
public ModelAndView helloWorld(){
ModelAndView model=new ModelAndView("HelloPage");
model.addObject("msg","hello page");
return model;
}
}
JSP頁面
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h2> {$msg}</h2>
</body>
</html>
下面是輸出
謝謝你,我知道它的愚蠢的錯誤 –
很高興聽到... :)發生所有的時間,新鮮的眼睛通常幫助超過偉大的知識 –
哈哈很好的報價 –