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>
下面是输出
谢谢你,我知道它的愚蠢的错误 –
很高兴听到... :)发生所有的时间,新鲜的眼睛通常帮助超过伟大的知识 –
哈哈很好的报价 –