View
Learn how to create a view template and resolve a view name.
We'll cover the following
When a controller or handler returns a response back to the dispatcher servlet, it is either shown as it is to the user (if the @ResponseBody
annotation is present), or a view is called.
In real world applications, we do not return String
responses back to the user. We redirect the user to a view or JSP.
Redirecting to a view
Say, we want a request to "/"
to be redirected to main-menu.jsp
. We can return the view name as follows:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.