/** * 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); }
@Test public void jspMultipleResolvers() { this.registry.jsp().viewNames("view1", "view2"); this.registry.jsp().viewNames("view3", "view4"); assertNotNull(this.registry.getViewResolvers()); assertEquals(2, this.registry.getViewResolvers().size()); assertEquals(InternalResourceViewResolver.class, this.registry.getViewResolvers().get(0).getClass()); assertEquals(InternalResourceViewResolver.class, this.registry.getViewResolvers().get(1).getClass()); }
/** * 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); }
/** * 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); }