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 分钟前
2026自动售货机异常重启根因分析:从日志挖掘到内存取证的技术实践~YH
开发语言·数据库·单片机·嵌入式硬件·人机交互
奈斯先生Vector9 分钟前
从“能调用”到“可运营”:AI Agent 进入多模型时代后的架构升级
java·javascript·数据库·人工智能·算法·架构·aigc
Escalating_xu10 分钟前
【C++类和对象(上)】从类的定义、封装与对象模型到内存对齐和 this 指针
开发语言·前端·c++
Json____12 分钟前
宿舍安全卫生检查系统:Node 全栈开发实战
java·前端·数据库·毕业设计·课程设计·毕设·wwwoop.com
阿里嘎多学长14 分钟前
2026-08-30 GitHub 热点项目精选
开发语言·程序员·github·代码托管
pnoker15 分钟前
36 个驱动模块:应对协议碎片化
java·物联网·modbus·工业互联网·opc ua
码上有光16 分钟前
Linux:进程控制和进程替换
java·linux·服务器·进程控制·进程替换
默辨18 分钟前
我用Java后端的视角读了一遍JoyAgent-JDGenie
java·开发语言
常山云栈19 分钟前
如何理解python中的鸭子模(类)型?
开发语言·python