Java(Springboot)

get请求

在Controller中--->从仓库里取出要用的mysql----->对于get请求(httpsession,model容器)----->从httpsession取出userid再赋值给userid----->用userid在mysql获取用户的信息------>然后用户的信息在保存在model容器里---->return到html地址里面

put请求

得到请求体的参数--->从httpsession取出userid再赋值给userid----->根据用户id查找数据库----->更新user_id里面的数据------>保存到数据库里面-----return ResponseEntity.ok

Thymeleaf 语法解释

复制代码
​
<span th:text="${user.username}"></span>
<a th:href="@{/profile/{id}(id=${user.id})}">View Profile</a>
<img th:src="@{${user.profilePictureUrl}}" alt="User Profile Picture"/>
<img th:src="@{${user.profilePictureUrl}}" alt="User Profile Picture"/>
<div th:class="${user.active} ? 'active' : 'inactive'">User Profile</div>
<p th:if="${user.isActive}">User is active</p>
<p th:unless="${user.isActive}">User is inactive</p>
<ul>
    <li th:each="user : ${users}" th:text="${user.username}"></li>
</ul>
<form th:action="@{/submit}" th:object="${user}">
    <input type="text" th:field="*{username}" />
    <input type="password" th:field="*{password}" />
    <button type="submit">Submit</button>
</form>

​

123

相关推荐
@小码农5 分钟前
202512 电子学会 Scratch图形化编程等级考试四级真题(附答案)
java·开发语言·算法
ejjdhdjdjdjdjjsl11 分钟前
C#类型转换与异常处理全解析
开发语言·c#
程序猿ZhangSir13 分钟前
深入理解 BIO,NIO,AIO 三者的用途和区别?Select,poll,epoll 操作系统函数简介
java·spring·nio
智航GIS14 分钟前
6.2 while循环
java·前端·python
2201_7578308714 分钟前
AOP核心概念
java·前端·数据库
为所欲为、Lynn16 分钟前
用FastJson的Filter自动映射枚举
java·spring boot
qq_3363139316 分钟前
java基础-IO流(转换流)
java·开发语言·python
小宇的天下16 分钟前
Calibre nmDRC 运行机制与规则文件(13-2)
运维·开发语言
雪人.17 分钟前
JavaWeb经典面试题
java·服务器·前端·java面试题
扶苏-su20 分钟前
Java---IO流原理和分类
java·开发语言