• <noscript id="ecgc0"><kbd id="ecgc0"></kbd></noscript>
    <menu id="ecgc0"></menu>
  • <tt id="ecgc0"></tt>

    spring boot整合freemarker模板引擎框架

    freemarker是一個java web模板引擎框架,spring boot項目若何利用freemarker框架,下面將具體經由過程實踐來介紹

    東西/原料

    • spring boot框架
    • freemarker框架
    • intellij idea軟件

    方式/步調

    1. 1

      打開intellij idea軟件,建立spring boot項目

    2. 2

      建立當作功之后,項目布局如下圖所示

    3. 3

      為項目添加maven依靠,代碼如下

                         <dependency>

                                 <groupId>org.springframework.boot</groupId>

                                 <artifactId>spring-boot-starter-freemarker</artifactId>

                         </dependency>

                         <dependency>

                                  <groupId>org.springframework.boot</groupId>

                                  <artifactId>spring-boot-starter-web</artifactId>

                         </dependency>

    4. 4

      添加一個Controller,跳轉到指標的目的頁面,默認會從templates文件夾下加載頁面

      代碼如下

      @Controller

      @RequestMapping("/ftl")

      public class TestController {

       

          @RequestMapping("")

          public String test(HttpServletRequest request){

              request.setAttribute("user","zuli");

              return "1";

          }

      }

    5. 5

      在templates目次下添加1.ftl文件,2.ftl文件

    6. 6

      打開瀏覽器,拜候localhost:8080/ftl路徑,查看結果

    注重事項

    • 但愿能幫忙你
    • 感激點贊,感激存眷
    • 發表于 2018-10-10 00:00
    • 閱讀 ( 520 )
    • 分類:其他類型

    你可能感興趣的文章

    相關問題

    0 條評論

    請先 登錄 后評論
    admin
    admin

    0 篇文章

    作家榜 ?

    1. xiaonan123 189 文章
    2. 湯依妹兒 97 文章
    3. luogf229 46 文章
    4. jy02406749 45 文章
    5. 小凡 34 文章
    6. Daisy萌 32 文章
    7. 我的QQ3117863681 24 文章
    8. 華志健 23 文章

    聯系我們:uytrv@hotmail.com 問答工具
  • <noscript id="ecgc0"><kbd id="ecgc0"></kbd></noscript>
    <menu id="ecgc0"></menu>
  • <tt id="ecgc0"></tt>
    久久久久精品国产麻豆