I try to write the simplest application with Spring MVC (like Hello, World!). Like everything I do according to the textbook. But the result is the html page on which $ {<parameter name>} is displayed instead of the model attribute values transferred from the controller. Ie, for example, in the controller I write:
modelAndView.addObject("body", "Have a nice day!"); in JSP:
<!DOCTYPE html> <html> <head> <title>${title}</title> </head> <body> This is the body: ${body} </body> </html> As a result, the page is displayed:
This is the body: $ {body}
I almost all the Internet, I can not find a solution. The program enters the controller and returns the required values.
Here is the complete controller code:
@Controller public class MainController { @RequestMapping(value="/", method = RequestMethod.GET) public ModelAndView main() { ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("title", "Hello!"); modelAndView.addObject("body", "Have a nice day!"); modelAndView.setViewName("index"); return modelAndView; } }