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

相关推荐
广州服务器托管17 分钟前
[2026.1.6]WINPE运维版20260106,带网络功能的PE维护系统
运维·开发语言·windows·计算机网络·个人开发·可信计算技术
毕设源码-朱学姐21 分钟前
【开题答辩全过程】以 日程管理系统为例,包含答辩的问题和答案
java
a努力。25 分钟前
京东Java面试被问:双亲委派模型被破坏的场景和原理
java·开发语言·后端·python·面试·linq
冰暮流星25 分钟前
javascript赋值运算符
开发语言·javascript·ecmascript
谢娘蓝桥25 分钟前
adi sharc c/C++ 语言指令优化
开发语言·c++
小毛驴85031 分钟前
Maven同时配置阿里云仓库和私有仓库
java·阿里云·maven
刘975332 分钟前
【第25天】25c#今日小结
java·开发语言·c#
不如打代码KK34 分钟前
Springboot如何解决跨域问题?
java·spring boot·后端
豆沙沙包?36 分钟前
2026年--Lc330-394. 字符串解码(栈)--java版
java·开发语言
蓝程序37 分钟前
Spring AI学习 程序接入大模型
java·人工智能·spring