java - thymeleaf模板引擎前端开发时怎么预览效果
ringa_lee
ringa_lee 2017-04-17 17:29:21
0
1
415

Java web用springboot开发web application时,前端部分用thymeleaf模板引擎,现在希望页面可以组装,就是头部单独写,每个页面都用那个头部,尾部等一样,就像php的blade。

查阅thymeleaf的文档发现是提供了继承的,th:fragment和th:replace就可以完成我希望的工作。

但是现在在yeoman这一套前端开发流程下,里面是纯的HTML,不能试试预览是否有效果。

怎么更好地解决这个问题,或者说有什么方法可以更方便地写java web的前端么?

ringa_lee
ringa_lee

ringa_lee

répondre à tous(1)
洪涛

Thymeleaf模板文件是一个格式良好的HTML文件,所以可以直接打开看效果。基于这种宗旨Thymeleaf的继承和替换其实是需要每个文件要重复写头部的,如果不重复写就不能达到直接打开查看效果的目的。所以是否需要每个页面都可以打开看效果,这里是需要取舍的。可以参考Demo:https://github.com/thymeleaf/thymeleafexamples-petclinic

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!