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

相关推荐
lskisme7 分钟前
springboot maven导入本地jar包
开发语言·python·pycharm
SheepHappy12 分钟前
MyBatis-Plus 源码阅读(二)代码生成器原理深度剖析
java·源码阅读
雨白21 分钟前
重识 Java IO、NIO 与 OkIO
android·java
light_in_hand22 分钟前
内存区域划分——垃圾回收
java·jvm·算法
金銀銅鐵23 分钟前
[Java] JDK 9 新变化之 Convenience Factory Methods for Collections
java·后端
开心-开心急了27 分钟前
pyside6实现win10自动切换主题
开发语言·python·pyqt·pyside
沐知全栈开发1 小时前
Foundation 模态框
开发语言
wjs20241 小时前
CSS 导航栏
开发语言
用户7406696136251 小时前
入门并理解Java模块化系统(JPMS)
java
金銀銅鐵1 小时前
[Java] 用 Swing 生成一个最大公约数计算器
java·后端