• thymeleaf控制view的返回格式


    package com.ailk.dd1.jike.web.config;
    
    import nz.net.ultraq.thymeleaf.LayoutDialect;
    
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;
    import org.thymeleaf.spring4.SpringTemplateEngine;
    import org.thymeleaf.spring4.view.ThymeleafViewResolver;
    import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;
    //import com.ailk.retail.web.thymeleaf.expression.SmallFunctionHelper;
    
    @Configuration
    public class ViewConfiguration {
    
        @Bean
        public ClassLoaderTemplateResolver templateResolver() {
            ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
            templateResolver.setTemplateMode("HTML5");
            templateResolver.setPrefix("pages/");
            templateResolver.setSuffix(".html");
            templateResolver.setCharacterEncoding("utf-8");
            templateResolver.setOrder(1);
    
            templateResolver.setCacheable(false);
            return templateResolver;
        }
    
        @Bean
        public SpringTemplateEngine templateEngine() {
            SpringTemplateEngine engine = new SpringTemplateEngine();
            engine.setTemplateResolver(templateResolver());
    //        engine.addDialect(new DataTablesDialect());
            engine.addDialect(new LayoutDialect());
            return engine;
        }
    
        @Bean
        public ThymeleafViewResolver thymeleafViewResolver() {
            ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
            viewResolver.setTemplateEngine(templateEngine());
            viewResolver.setCharacterEncoding("utf-8");
    //        SmallFunctionHelper.addSmallFunctionTag(viewResolver);
            return viewResolver;
        }
    
    }
    

      

  • 相关阅读:
    nginx+keepalived实现高可用
    zookeeper集群和安装dubbo的管控台
    常见设计模式的解析和实现(C++)
    sed的工作原理(pattern space 和 hold space)
    sed学习笔记
    C++协助破案问题
    C++中extern “C”含义深层探索
    阿里巴巴笔试第28题
    阿里巴巴集团2014校园招聘笔试题(研发工程师--北邮站)
    淘宝数据魔方技术架构解析
  • 原文地址:https://www.cnblogs.com/ZSG-DoBestMe/p/5138751.html
Copyright © 2020-2023  润新知