宋子宪博客

Szx

SpringBoot集成beetl模板快速入门
在pom文件引入maven依赖 <dependency> <groupId&...
扫描右侧二维码阅读全文
21
2019/05

SpringBoot集成beetl模板快速入门

在pom文件引入maven依赖

   <dependency>
        <groupId>com.ibeetl</groupId>
        <artifactId>beetl-framework-starter</artifactId>
        <version>1.1.81.RELEASE</version>
    </dependency>

写一个controller

/**
 * @author songzixian
 * @create 2019-05-21 下午 3:27
 * @description
 */
    @Controller
    public class Index {
    
        @RequestMapping("/")
        public String index(HttpServletRequest request){
    
            request.setAttribute("test"," Spring Boot集成Beetl成功");
            return "index.btl";
        }
    
    }

在resources目录建立一个index.btl文件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>demo</title>
</head>
<body>

${test}

</body>
</html>

启动项目,测试
Image 1.png

Last modification:June 26th, 2019 at 01:52 am
如果觉得这篇技术文章对您有帮助,可以请博主喝一杯饮料

Leave a Comment