本文整理汇总了Java中org.springframework.web.servlet.view.velocity.VelocityViewResolver.setSuffix方法的典型用法代码示例。如果您正苦于以下问题:Java VelocityViewResolver.setSuffix方法的具体用法?Java VelocityViewResolver.setSuffix怎么用?Java VelocityViewResolver.setSuffix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.view.velocity.VelocityViewResolver
的用法示例。
在下文中一共展示了VelocityViewResolver.setSuffix方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: viewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
/**
* 视图解析器
* velocity
* 过期是由于velocity六年没有更新过了,spring官方推荐使用FreeMarker或者Thymeleaf
* 后期考虑spring官方的Thymeleaf
*/
@Bean
public ViewResolver viewResolver() {
/* InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setContentType("text/html;charset=utf-8");
viewResolver.setPrefix("/static/");
viewResolver.setSuffix(".html");
return viewResolver;*/
VelocityViewResolver velocityViewResolver = new VelocityViewResolver();
velocityViewResolver.setCache(true);
velocityViewResolver.setPrefix("");
velocityViewResolver.setSuffix(".html");
velocityViewResolver.setContentType("text/html;charset=utf-8");
//关于Toolbox路径问题:如何路径开始头没有/会自动加上/,所以你如果写classpath:之类的识别不了
velocityViewResolver.setToolboxConfigLocation("/WEB-INF/velocityToolBox.xml");
velocityViewResolver.setViewClass(VelocityToolboxView.class);
return velocityViewResolver;
}
示例2: velocityViewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
@Bean
VelocityViewResolver velocityViewResolver() {
VelocityViewResolver resolver = new VelocityViewResolver();
resolver.setSuffix(this.environment.getProperty("suffix", ".vm"));
resolver.setPrefix(this.environment.getProperty("prefix", "/public/"));
// Needs to come before any fallback resolver (e.g. a
// InternalResourceViewResolver)
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 20);
Properties p = new Properties();
p.put(Velocity.FILE_RESOURCE_LOADER_PATH, "/public/");
p.put("input.encoding", "utf-8");
p.put("output.encoding", "utf-8");
resolver.setAttributes(p);
resolver.setContentType("text/html;charset=utf-8");
return resolver;
}
示例3: velocityViewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
/**
* actual resolver for the html files
*
* @return
*/
@Bean
public VelocityViewResolver velocityViewResolver()
{
VelocityViewResolver vvw = new VelocityViewResolver();
vvw.setPrefix( "" );
vvw.setSuffix( ".html" );
// TODO in production we might actuall enable caching
vvw.setCache( false );
vvw.setExposeSpringMacroHelpers( true );
return vvw;
}
示例4: velocityViewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
@Bean
VelocityViewResolver velocityViewResolver() {
VelocityViewResolver resolver = new VelocityViewResolver();
resolver.setSuffix(this.environment.getProperty("suffix", ".vm"));
resolver.setPrefix(this.environment.getProperty("prefix", "/templates/"));
// Needs to come before any fallback resolver (e.g. a
// InternalResourceViewResolver)
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 20);
return resolver;
}
示例5: velocityViewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver velocityViewResolver() {
VelocityViewResolver viewResolver = new VelocityViewResolver();
viewResolver.setSuffix(".vm");
viewResolver.setExposeSpringMacroHelpers(true);
viewResolver.setOrder(1);
viewResolver.setContentType("text/html; charset=UTF-8");
return viewResolver;
}
示例6: viewResolver
import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
@Bean
public VelocityViewResolver viewResolver() {
VelocityViewResolver resolver = new VelocityViewResolver();
resolver.setSuffix(".html");
return resolver;
}