当前位置: 首页>>代码示例>>Java>>正文


Java VelocityViewResolver.setSuffix方法代码示例

本文整理汇总了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;
}
 
开发者ID:hadesvip,项目名称:ssm-shiro,代码行数:25,代码来源:MVConfig.java

示例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;
}
 
开发者ID:shunfei,项目名称:DCMonitor,代码行数:17,代码来源:VelocityConfiguration.java

示例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;
}
 
开发者ID:cherimojava,项目名称:orchidae,代码行数:17,代码来源:WebMvcConfig.java

示例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;
}
 
开发者ID:joshlong,项目名称:boot-examples,代码行数:11,代码来源:Application.java

示例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;
}
 
开发者ID:npaulus,项目名称:Daily-Email-WebApp,代码行数:10,代码来源:ViewConfiguration.java

示例6: viewResolver

import org.springframework.web.servlet.view.velocity.VelocityViewResolver; //导入方法依赖的package包/类
@Bean
public VelocityViewResolver viewResolver() {
    VelocityViewResolver resolver = new VelocityViewResolver();
    resolver.setSuffix(".html");
    return resolver;
}
 
开发者ID:wolny,项目名称:mongodb-aggregation,代码行数:7,代码来源:Config.java


注:本文中的org.springframework.web.servlet.view.velocity.VelocityViewResolver.setSuffix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。