當前位置: 首頁>>代碼示例>>Java>>正文


Java ServletContextTemplateResolver.setCharacterEncoding方法代碼示例

本文整理匯總了Java中org.thymeleaf.templateresolver.ServletContextTemplateResolver.setCharacterEncoding方法的典型用法代碼示例。如果您正苦於以下問題:Java ServletContextTemplateResolver.setCharacterEncoding方法的具體用法?Java ServletContextTemplateResolver.setCharacterEncoding怎麽用?Java ServletContextTemplateResolver.setCharacterEncoding使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.thymeleaf.templateresolver.ServletContextTemplateResolver的用法示例。


在下文中一共展示了ServletContextTemplateResolver.setCharacterEncoding方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
 * Initialize the Thymeleaf template engine.
 */
@Override
public void init() {
	ServletConfig config = this.getServletConfig();

	ServletContextTemplateResolver templateresolver = new ServletContextTemplateResolver();
	templateresolver.setPrefix(config.getInitParameter(INIT_PARAM_PREFIX));
	templateresolver.setSuffix(config.getInitParameter(INIT_PARAM_SUFFIX));
	templateresolver.setTemplateMode(config.getInitParameter(INIT_PARAM_TEMPLATEMODE));
	templateresolver.setCacheable(false);
	templateresolver.setCharacterEncoding(CHARACTER_ENCODING);

	templateengine = new TemplateEngine();
	templateengine.setTemplateResolver(templateresolver);
       Set<IDialect> dialects = new HashSet<IDialect>();
	dialects.add(new SpringStandardDialect());
	dialects.add(new SqlDialect());
       templateengine.setDialects(dialects);
       templateengine.initialize();
}
 
開發者ID:jmiguelsamper,項目名稱:thymeleaf-extras-sqldialect,代碼行數:23,代碼來源:StandaloneThymeleafServlet.java

示例2: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver(ServletContext servletContext) {
    ServletContextTemplateResolver resolver = new ServletContextTemplateResolver(servletContext);
    resolver.setPrefix(VIEWS);
    resolver.setSuffix(".html");
    resolver.setTemplateMode("HTML");
    resolver.setCharacterEncoding("UTF-8");
    resolver.setOrder(1);
    return resolver;
}
 
開發者ID:astrohome,項目名稱:photogallery,代碼行數:11,代碼來源:WebMvcConfig.java

示例3: thymeleafViewResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ThymeleafViewResolver thymeleafViewResolver(WebApplicationContext wac) {
    ThymeleafViewResolver resolver = new ThymeleafViewResolver();
    SpringTemplateEngine templateEngine = new SpringTemplateEngine();
    ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
    templateResolver.setPrefix("/WEB-INF/templates/");
    templateResolver.setSuffix(".html");
    templateResolver.setTemplateMode("HTML5");
    templateResolver.setCharacterEncoding("UTF-8");
    templateEngine.setTemplateResolver(templateResolver);
    resolver.setTemplateEngine(templateEngine);
    resolver.setOrder(2);
    resolver.setApplicationContext(wac);
    resolver.setCharacterEncoding("UTF-8");

    //Enable the Spring Security Thymeleaf integration
    templateEngine.addDialect(new LayoutDialect());

    // caching
    String[] activeProfiles = env.getActiveProfiles();
    if (Arrays.asList(activeProfiles).contains("dev")) {
        log.info("DEV Profile is active. Disabling template caching.");
        templateResolver.setCacheable(false);
        templateEngine.setCacheManager(null);
        resolver.setCache(false);
    }
    return resolver;
}
 
開發者ID:acesinc,項目名稱:convergent-ui,代碼行數:29,代碼來源:MVCConfig.java

示例4: servletContextTemplateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
private ServletContextTemplateResolver servletContextTemplateResolver() {
	ServletContextTemplateResolver resolver = new ServletContextTemplateResolver();
	resolver.setCharacterEncoding(characterEncoding);
	resolver.setTemplateMode(templateMode);
	resolver.setCacheable(templateCacheEnabled);
	resolver.setOrder(1);
	return resolver;
}
 
開發者ID:connect-group,項目名稱:thymeleaf-tdd,代碼行數:9,代碼來源:ThymesheetConfig.java

示例5: defaultTemplateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public TemplateResolver defaultTemplateResolver() {
	ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
	templateResolver.setPrefix("/WEB-INF/");
	templateResolver.setSuffix(".html");
	templateResolver.setTemplateMode("HTML5");
	templateResolver.setCharacterEncoding("UTF-8");
	return templateResolver;
}
 
開發者ID:wysekm,項目名稱:DistributedSystemMonitoring,代碼行數:10,代碼來源:ThymeLeafConfig.java

示例6: templateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver templateResolver() {
    ServletContextTemplateResolver resolver =
            new ServletContextTemplateResolver();
    resolver.setPrefix("/views/");
    resolver.setSuffix(".html");
    resolver.setTemplateMode("HTML5");
    resolver.setOrder(1);
    resolver.setCacheable(false);
    resolver.setCharacterEncoding(DEFAULT_CHARSET.name());
    return resolver;
}
 
開發者ID:moss0801,項目名稱:apidoc,代碼行數:13,代碼來源:ServletConfig.java

示例7: configure

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
/**
 * Configure settings from the struts.xml or struts.properties, using sensible
 * defaults if values are not provided.
 */
public void configure() {
  ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
  templateResolver.setTemplateMode(templateMode);
  templateResolver.setCharacterEncoding(characterEncoding);
  templateResolver.setPrefix(prefix);
  templateResolver.setSuffix(suffix);
  templateResolver.setCacheable(cacheable);
  templateResolver.setCacheTTLMs(cacheTtlMillis);

  templateEngine = new TemplateEngine();
  templateEngine.setTemplateResolver(templateResolver);
  templateEngine.setMessageResolver(new StrutsMessageResolver());
}
 
開發者ID:codework,項目名稱:struts2-thymeleaf-plugin,代碼行數:18,代碼來源:DefaultTemplateEngineProvider.java

示例8: thymeleafTemplateResolver

import org.thymeleaf.templateresolver.ServletContextTemplateResolver; //導入方法依賴的package包/類
@Bean
public ServletContextTemplateResolver thymeleafTemplateResolver() {
	ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
	templateResolver.setPrefix("/WEB-INF/views/");
	templateResolver.setSuffix(".html");
	templateResolver.setTemplateMode("HTML5");
	templateResolver.setCharacterEncoding("UTF-8");
	// Uncomment these lines in order to use
	// cache when resolving templates.
	templateResolver.setCacheable(false);
	templateResolver.setCacheTTLMs(0L);
	// -------------------------------------
	return templateResolver;
}
 
開發者ID:fernaspiazu,項目名稱:recruiting-old-style,代碼行數:15,代碼來源:WebApplicationConfig.java


注:本文中的org.thymeleaf.templateresolver.ServletContextTemplateResolver.setCharacterEncoding方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。