我有这个无法正确输出模型的jsp代码:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Welcome File</title>
</head>
<body>
${message1}
</body>
</html>
重定向到这个页面的控制器如下:
@RequestMapping("/triangle")
public ModelAndView triangle() {
String message = "<br><div align='center'><h1>Triangle.<h1><br>";
ApplicationContext context = new ClassPathXmlApplicationContext("springContext.xml");
Triangle obj = (Triangle) context.getBean("triangle");
message += obj.draw();
System.out.println("Inside shape controller : " + message);
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("message1", message);
modelAndView.setViewName("output");
return modelAndView;
}
该页面逐字显示 ${message1},而不是字符串中的内容。我做错了什么?