Java Code Examples for org.springframework.web.servlet.view.InternalResourceViewResolver#setPrefix()

The following examples show how to use org.springframework.web.servlet.view.InternalResourceViewResolver#setPrefix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringMvcConfiguration.java    From junit-servers with MIT License 5 votes vote down vote up
@Bean
public ViewResolver getViewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setPrefix("/WEB-INF/views/");
	resolver.setSuffix(".jsp");
	return resolver;
}
 
Example 2
Source File: MvcConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    final InternalResourceViewResolver bean = new InternalResourceViewResolver();

    bean.setViewClass(JstlView.class);
    bean.setPrefix("/WEB-INF/view/");
    bean.setSuffix(".jsp");

    return bean;
}
 
Example 3
Source File: WebConfig.java    From maven-framework-project with MIT License 5 votes vote down vote up
@Bean
public InternalResourceViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setPrefix("/WEB-INF/view/");
	resolver.setSuffix(".jsp");
	return resolver;
}
 
Example 4
Source File: ViewResolutionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testJspOnly() throws Exception {

	InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
	viewResolver.setPrefix("/WEB-INF/");
	viewResolver.setSuffix(".jsp");

	standaloneSetup(new PersonController()).setViewResolvers(viewResolver).build()
		.perform(get("/person/Corea"))
			.andExpect(status().isOk())
			.andExpect(model().size(1))
			.andExpect(model().attributeExists("person"))
			.andExpect(forwardedUrl("/WEB-INF/person/show.jsp"));
}
 
Example 5
Source File: ApplicationConfigAdapter.java    From Agent-Benchmarks with Apache License 2.0 5 votes vote down vote up
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
    super.configureViewResolvers(registry);
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setPrefix("/pages/");
    viewResolver.setSuffix(".jsp");
    registry.viewResolver(viewResolver);
}
 
Example 6
Source File: WebConfig.java    From Spring5Tutorial with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver resolver =
                      new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    resolver.setExposeContextBeansAsAttributes(true);
    return resolver;
}
 
Example 7
Source File: ViewResolverRegistryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void customViewResolver() {
	InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
	viewResolver.setPrefix("/");
	viewResolver.setSuffix(".jsp");
	this.registry.viewResolver(viewResolver);
	assertSame(viewResolver, this.registry.getViewResolvers().get(0));
}
 
Example 8
Source File: WebConfig.java    From Spring with Apache License 2.0 5 votes vote down vote up
@Bean
public InternalResourceViewResolver getViewResolver(){
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/");
    resolver.setSuffix(".jsp" );
    resolver.setRequestContextAttribute("requestContext");
    return resolver;
}
 
Example 9
Source File: MvcConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    final InternalResourceViewResolver bean = new InternalResourceViewResolver();

    bean.setViewClass(JstlView.class);
    bean.setPrefix("/WEB-INF/view/");
    bean.setSuffix(".jsp");

    return bean;
}
 
Example 10
Source File: ApplicationConfigAdapter.java    From Agent-Benchmarks with Apache License 2.0 5 votes vote down vote up
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
    super.configureViewResolvers(registry);
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setPrefix("/pages/");
    viewResolver.setSuffix(".jsp");
    registry.viewResolver(viewResolver);
}
 
Example 11
Source File: WebConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setPrefix("/WEB-INF/views/");
	resolver.setSuffix(".jsp");
	return resolver;
}
 
Example 12
Source File: MvcConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    final InternalResourceViewResolver bean = new InternalResourceViewResolver();
    bean.setViewClass(JstlView.class);
    bean.setPrefix("/WEB-INF/view/");
    bean.setSuffix(".jsp");
    return bean;
}
 
Example 13
Source File: SwaggerConfig.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setViewClass(JstlView.class);
	resolver.setPrefix("/");
	resolver.setSuffix(".html");
	return resolver;

}
 
Example 14
Source File: SwaggerConfig.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setViewClass(JstlView.class);
	resolver.setPrefix("/");
	resolver.setSuffix(".html");
	return resolver;

}
 
Example 15
Source File: SpringDispatcherConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean
public InternalResourceViewResolver jspViewResolver() {
    InternalResourceViewResolver viewResolverA = new InternalResourceViewResolver();
    viewResolverA.setPrefix("/WEB-INF/jsp/");
    viewResolverA.setSuffix(".jsp");
    viewResolverA.setOrder(1);
    return viewResolverA;
}
 
Example 16
Source File: SwaggerConfig.java    From open-capacity-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setViewClass(JstlView.class);
	resolver.setPrefix("/");
	resolver.setSuffix(".html");
	return resolver;

}
 
Example 17
Source File: WebAppConfig.java    From logsniffer with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Defines view resolver.
 * 
 * @return
 */
@Bean
public ViewResolver viewResolver() {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setPrefix("/WEB-INF/views/");
	resolver.setSuffix(".jsp");
	return resolver;
}
 
Example 18
Source File: WebConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver bean = new InternalResourceViewResolver();
    bean.setPrefix("/WEB-INF/");
    bean.setSuffix(".jsp");
    return bean;
}
 
Example 19
Source File: RenditionFormatTest.java    From Spring-MVC-Blueprints with MIT License 4 votes vote down vote up
@Before
public void setup() {
	 MockitoAnnotations.initMocks(this);
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setPrefix("/WEB-INF/admin_report/hrms/");
    viewResolver.setSuffix(".jsp");
  
	 
    mockMvc = MockMvcBuilders.standaloneSetup(new AdminContentNegoController())
                             .setViewResolvers(viewResolver)
                             .build();
    
    
    
    
}
 
Example 20
Source File: ViewResolverRegistry.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Register JSP view resolver with the specified prefix and suffix.
 * <p>When this method is invoked more than once, each call will register a
 * new ViewResolver instance. Note that since it's not easy to determine
 * if a JSP exists without forwarding to it, using multiple JSP-based view
 * resolvers only makes sense in combination with the "viewNames" property
 * on the resolver indicating which view names are handled by which resolver.
 */
public UrlBasedViewResolverRegistration jsp(String prefix, String suffix) {
	InternalResourceViewResolver resolver = new InternalResourceViewResolver();
	resolver.setPrefix(prefix);
	resolver.setSuffix(suffix);
	this.viewResolvers.add(resolver);
	return new UrlBasedViewResolverRegistration(resolver);
}