在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 26, 2019
如果觉得这篇技术文章对你有用,请随意赞赏