Mastering Spring 5.0
上QQ阅读APP看书,第一时间看更新

Creating a View - a JSP

Let's create welcome.jsp in the src/main/webapp/WEB-INF/views/welcome.jsp folder with the following content:

    <html> 
<head>
<title>Welcome</title>
</head>
<body>
<p>Welcome! This is coming from a view - a JSP</p>
</body>
</html>

This is a simple HTML with head, body, and some text in the body.

Spring MVC has to map the string returned from the welcome method to the real JSP at /WEB-INF/views/welcome.jsp. How does this magic happen?