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

相关推荐
美好的事情能不能发生在我身上3 小时前
Hot100中的:贪心专题
java·数据结构·算法
myloveasuka4 小时前
Java与C++多态访问成员变量/方法 对比
java·开发语言·c++
2301_821700534 小时前
C++编译期多态实现
开发语言·c++·算法
Andya_net4 小时前
Spring | @EventListener事件机制深度解析
java·后端·spring
奥地利落榜美术生灬4 小时前
c++ 锁相关(mutex 等)
开发语言·c++
xixihaha13244 小时前
C++与FPGA协同设计
开发语言·c++·算法
lang201509284 小时前
18 Byte Buddy 进阶指南:解锁 `@Pipe` 注解,实现灵活的方法转发
java·byte buddy
重庆小透明4 小时前
【java基础篇】详解BigDecimal
java·开发语言
sunwenjian8864 小时前
Springboot项目本地连接并操作MySQL数据库
数据库·spring boot·mysql
ID_180079054734 小时前
模拟1688商品详情的Python API实现,返回符合风格的JSON数据
开发语言·python·json