Java Code Examples for org.springframework.web.servlet.config.annotation.ViewResolverRegistry

Following code examples demonstrate how to use org.springframework.web.servlet.config.annotation.ViewResolverRegistryfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.web.servlet.config.annotation.ViewResolverRegistryand various code implementation of this class.

	public void configureViewResolvers(ViewResolverRegistry registry) {
		InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
		viewResolver.setViewClass(JstlView.class);
		viewResolver.setPrefix("/static/views/");
		viewResolver.setSuffix(".jsp");
		registry.viewResolver(viewResolver);
	} 


	public void configureViewResolvers(ViewResolverRegistry viewResolverRegistry) {
		viewResolverRegistry.jsp().prefix("/WEB-INF/jsp/");
		TilesViewResolver viewResolver = new TilesViewResolver();
		viewResolverRegistry.viewResolver(viewResolver);
	} 

	public void configureViewResolvers(final ViewResolverRegistry registry) {
		final TilesViewResolver viewResolver = new TilesViewResolver();
		registry.viewResolver(viewResolver);
	} 

    public void configureViewResolvers(ViewResolverRegistry registry) {
        InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
        viewResolver.setViewClass(JstlView.class);
        viewResolver.setPrefix("/WEB-INF/views/");
        viewResolver.setSuffix(".jsp");
        registry.viewResolver(viewResolver);
    } 

	protected void configureViewResolvers(ViewResolverRegistry registry) {
		InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
		viewResolver.setViewClass(JstlView.class);
		viewResolver.setPrefix("/");
		viewResolver.setSuffix(".xhtml");
		registry.viewResolver(viewResolver);
	} 

	public void configureViewResolvers(ViewResolverRegistry registry) {
		InternalResourceViewResolver resolver = new InternalResourceViewResolver();
		resolver.setPrefix("/WEB-INF/views/");
		resolver.setSuffix(".jsp");
		resolver.setViewClass(JstlView.class);
		registry.viewResolver(resolver);

		WebMvcConfigurer.super.configureViewResolvers(registry);

	} 

	public void configureViewResolvers(ViewResolverRegistry registry) {
		InternalResourceViewResolver resolver = 
				new InternalResourceViewResolver();
		resolver.setPrefix("/WEB-INF/views/");
		resolver.setSuffix(".jsp");
		resolver.setViewClass(JstlView.class);
		registry.viewResolver(resolver);
	} 

Advertisement
Javadoc
Assist with the configuration of a chain of org.springframework.web.servlet.ViewResolver ViewResolve

r instances. This class is expected to be used via WebMvcConfigurer#configureViewResolvers. @author Sebastien Deleuze @author Rossen Stoyanchev @since 4.1

Read More
Advertisement