首页 > 其他分享 >230124_50_SpringBoot入门

230124_50_SpringBoot入门

时间:2023-01-24 20:11:53浏览次数:41  
标签:SpringBoot 50 addAttribute 230124 controller html

  • thymeleaf语法

  • 1.th:utext,转义文本

    • controller
    model.addAttribute("msg","<h1>hello,springboot!</h1>");
    
    • html
    <div th:text="${msg}"></div>
    
    <div th:utext="${msg}"></div>
    

测试结果:

  • 2.遍历数据
  • controller
model.addAttribute("users", Arrays.asList("bill","tom"));
  • html
<h1 th:each="user:${users}" th:text="${user}"></h1>

测试结果

标签:SpringBoot,50,addAttribute,230124,controller,html
From: https://www.cnblogs.com/wcwblog/p/17066321.html

相关文章

  • springboot+myBatis
    mybatis依赖<!--mybatis依赖--><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-start......
  • SpringBoot开发Restful API及使用jmeter测试
     Restful API简介Representational State Transfer,简称为REST, 即表现层状态转化,简单来说,客户端通过HTTP方法对服务器的资源进行操作, 实现表现层状态转化GET:获取......
  • ABB 800XA学习笔记50:项目框架结构2
    这一篇学习笔记我在新浪博客记录过,地址是ABB800XA学习笔记50:项目框架结构2_来自金沙江的小鱼_新浪博客(sina.com.cn)在这里也记录一遍,以免丢失继续学习5.2自动化解决......
  • 230123_50_SpringBoot入门
    首页和图标定制首页:新建index文件,放到静态资源加载目录<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>首页-测试</title></head>......
  • SpringBoot-JDBC
    1.引入JDBC依赖<!--JDBC--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-jdbc</art......
  • springboot文件操作之更新头像
    就是在个人中心中,点击更改个人头像,上面立马更新的那种:利用了springboot的文件上传的技术,不知道的可以看看这个博客  由于这个侧边栏,上面栏,主屏幕属于三个部分,所以可......
  • springboot+vue整合文件,照片上传
    1.建立一个File的数据库CREATETABLE`sys_file`(`id`int(11)NOTNULLAUTO_INCREMENTCOMMENT'id',`name`varchar(255)COLLATEutf8mb4_unicode_ciDEFAUL......
  • SpringBoot单元测试
    接上一篇:https://www.cnblogs.com/uncleyong/p/17065293.html添加依赖<dependency><groupId>org.springframework.boot</groupId><a......
  • SpringBoot整合MyBatis
     添加pom依赖<dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.16.18<......
  • SpringBoot集成JWT实现token验证
    一、简介Jwt全称是:jsonwebtoken。它将用户信息加密到token里,服务器不保存任何用户信息。服务器通过使用保存的密钥验证token的正确性,只要正确即通过验证。优点简洁......