極簡SpringBoot配置beetl模板引擎

2021-10-23 10:43:49 字數 3788 閱讀 4904

這是乙個國產的,

超過thymeleaf效能十倍的模板引擎,

沒有理由不學會它!

我們建立乙個springboot專案

在專案中pom檔案中加入

org.springframework.boot

spring-boot-starter-web

com.ibeetl

beetl-framework-starter

1.2.33.release

3.分別建立indexcontroller, index.html, show1.html, show2.html, index.css檔案如圖

**分別為:

indexcontroller

@controller

public

class

indexcontroller

)public modelandview index()

private

static string[

] contents =

("綠蟻浮觴香泛泛,黃花共薦芳辰。\n清霜天宇淨無塵。\n登高宜有賦,拈筆戲成文。\n可奈園林搖落盡,悲秋意與誰論。\n眼中相識幾番新。\n龍山高會處,落帽定何人。").

split

("\n");

private

static random random =

newrandom()

;(path =

"show1"

)public string showone

(model model)

(path =

"show2"

)public string showtow

(map

data)

index.html

>

>

charset

="utf-8"

>

name

="viewport"

content

="width=device-width, initial-scale=1"

>

name

="description"

content

="springboot beetl"

/>

name

="author"

content

="summer"

/>

name

="viewport"

content

="width=device-width, initial-scale=1.0"

/>

>

springboot beetl demotitle

>

rel=

"stylesheet"

href

="index.css"

/>

head

>

>

>

class

="title"

>

hello world!div

>

/>

class

="content"

>

>

/>

class

="sign"

>

當前時間 $div

>

/>

href

="show1"

>

傳參2測試a

>   

href

="show2"

>

傳參3測試a

>

div>

body

>

html

>

show1.html

>

>

charset

="utf-8"

>

name

="viewport"

content

="width=device-width, initial-scale=1"

>

name

="description"

content

="springboot beetl"

/>

name

="author"

content

="summer"

/>

name

="viewport"

content

="width=device-width, initial-scale=1.0"

/>

title

>

rel=

"stylesheet"

href

="index.css"

/>

head

>

>

>

class

="title"

>

$div

>

class

="content"

>

$div

>

div>

body

>

html

>

show2.html

xmlns:th

="">

>

charset

="utf-8"

>

name

="viewport"

content

="width=device-width, initial-scale=1"

>

name

="description"

content

="springboot beetl"

/>

name

="author"

content

="summer"

/>

name

="viewport"

content

="width=device-width, initial-scale=1.0"

/>

>

springboot beetl demotitle

>

rel=

"stylesheet"

href

="index.css"

/>

head

>

>

>

class

="title"

>

$div

>

class

="content"

>

$div

>

div>

body

>

html

>

index.css

.title

.content

.sign

最後啟動專案,在頁面輸入localhost:8080/,頁面如下

vim配置極簡推薦

使用vim編輯器開啟 vimrc修改配置,沒有會自動建立 vim vimrc 輸入以下配置 設定編碼 set fileencodings utf 8,ucs bom,gb18030,gbk,gb2312,cp936 set termencoding utf 8 set encoding utf 8 ...

python極簡主義 極簡主義OCR

在編寫這個程式時,我一直有個疑惑,就是在east文字檢測模組裡。起初,我是在裡看到用opencv的dnn模組做east文字檢測,但是它的讀取模型檔案初始化網路的方式我一直疑惑不解。看text detect recognition.py的第152行 detector cv.dnn.readnet mo...

(10 1 6)極簡主義

極簡主義不光存在於網頁設計中,像logo設計 印刷設計 包裝設計也都有相應的極簡主義風格。目前流行的極簡主義網頁設計視覺風格是 使用純粹的色彩以及簡練唯美的 極簡主義網頁設計流行使用創新式導航,不但易用,而且有種簡約美,符合極簡主義 回歸功能 與 視覺簡約 的雙重理念。簡約的外觀 易用的功能,並不意...