i am new to Spring Mvc,so i have this simple question below
Code1:
@RequestMapping("/hello")
public ModelAndView hello()
{
String str="Be happy!!!!!";
return new ModelAndView("hello","message",str);
}
In hello.jsp View Page ,when i print str then i get result as ${message}
code2:
@RequestMapping("/hello")
public ModelAndView hello()
{
String str="Be happy!!!!!";
return new ModelAndView("hellopage","message",str);
}
but in hellopage.jsp i get result as Be happy!!!!!
so why above code1 does not print str string?
below is my view page jsp code and it is same for both hello.jsp and hellopage.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">
</head>
<body>
${message}
</body>
</html>