Spring 3 comes with view-controller which we can use as a tag in XML.
We need not write a method to just re-direct it to a view if you don’t have anything to do in controller.
Fortunately Spring 3 has a better way where you can configure (or register if you are using XML free configuration) if you don’t have anything to do in controller method and just want to invoke view.
Spring 3 comes with view-controller which we can use as a tag in XML.
Or alternatively in XML free configuration approach…
Behind the scenes,
mvc:view-controller
registers a ParameterizableViewController
that selects a view for rendering. In this case, when “/” is requested, the index view is rendered. The actual view template is a .jsp resolved inside the /WEB-INF/views directory.
The complete XML file will look similar to below.
XML Free Web MVC Configuration will need following implementation.
No comments:
Post a Comment