I am learning spring mvc and using jsp as my view layer but I have a problem with jsp page when I put a an attribute in model like that
@RequestMapping
public String sayHello(ModelMap model)
{
model.addAttribute("message","welcome to 3-IDIOTS web store");
return "hello";
}
then inside the jsp page hello.jsp I try to use it like that
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<h2>${message}</h2>
<body>
</body>
</html>
then start to run tomcat and run the application I get this this is what happens when I run tomcat
note: I know that I can solve it using the following code
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String message =(String) request.getAttribute("message");
%>
<html>
<head>
<title>Title</title>
</head>
<h2><%=message%></h2>
<body>
</body>
</html>
but I want to know why the code using ${meassage} is not working.