July 2018
Intermediate to advanced
268 pages
7h 36m
English
As shown in the following code, here we will be creating Spring MVC specific Java configurations (SpringMVCConfig.java):
@Configuration@EnableWebMvc@ComponentScan( basePackages = "com.packtpub")public class SpringMVCConfig implements WebMvcConfigurer { @Override public void configureViewResolvers(ViewResolverRegistry registry) { registry.jsp().prefix("/WEB-INF/views/").suffix(".jsp"); } @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login"); }}
In this configuration, set the view's prefix and suffix. Make sure that your login view controller is added explicitly, as we don't have a route defined in our controller (we will see the controller later).
Read now
Unlock full access