springboot 项目小结thymeleaf layui 使用小结

发布时间:2020-07-23 17:11:25 作者:老萧23
来源:网络 阅读:2428
  1. 第一是 thymeleaf 的使用

  1. thymelaf 的 循环迭代

    <ul class="layui-nav layui-nav-tree" lay-filter="side-main" >
               <li class="layui-nav-item" th:each="menu: ${list}">
                    <a href="javascript:;" th:text="${menu.text}"> <i class="layui-icon">&#xe620;</i>基础</a>
                    <dl class="layui-nav-child">
                    <dd th:each="record:${menu.childmenus}">
                   <!--  th:href="@{${record.href}}" -->
                   <!--  <span th:text="${record.href}" class="change"></span> -->
                    <a th:href="@{${record.href}}" > 
                    <i class="layui-icon" ></i>
                    <span th:text="${record.ctext}"></span>
                    </a>
    
                    </dd>
                    <!-- <dd><a href="javascript:;" href-url="login.jsp"><i class="layui-icon">&#xe621;</i>登录页</a></dd> -->
    
                    </dl>
                </li>
            </ul>

3thymeleaf 的 安装 很简单 导入maven 并且在 application.配置文件中进行配置

spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.cache=false
spring.thymeleaf.prefix=/WEB-INF/
spring.thymeleaf.suffix=.html

maven文件

<!-- thymeleaf模板引擎,访问静态资源 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- 引入该包为了让application.properites中的 spring.thymeleaf.mode=LEGACYHTML5 生效,
是为了解决 thymeleaf模板引擎过于严格的HTML校验-->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>

4总结

thymeleaf 是很不错的模板 和jsp freeemaker 比较相似 但还是有不同 是springboot 推荐的模板标签。

不同之处:
https://blog.csdn.net/qq_33314107/article/details/80834894

推荐阅读:
  1. SpringBoot 2.0 开发案例之整合Shiro安全框架
  2. TIMO后台管理系统—基于SpringBoot开发

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

springboot java web

上一篇:怎样删除php数组中的第一个元素

下一篇:怎么使用php将json转化为数组

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》