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

相关推荐
BUG研究员_9 小时前
Runnable与LCEL
开发语言·人工智能·python
码农颜10 小时前
5.4.1 锁分类
java·数据库·mysql
牛艺翔11 小时前
C++基础
开发语言·c++
键盘会跳舞11 小时前
C++ :容器适配器stack源码级拆解
开发语言·c++··stack·先进后出
linux-hzh11 小时前
百日算法修炼 · Day 03
java·算法
美味蛋炒饭.11 小时前
Git 版本控制(下)
开发语言·git·学习·总结·后端开发
我星期八休息12 小时前
网络编程—网络层
开发语言·前端·网络·人工智能·智能路由器
问商十三载12 小时前
RAG 检索效果差怎么排查?2026 五层诊断法完整指南
开发语言·人工智能·windows·python·算法
不负岁月无痕12 小时前
简单理解操作系统结构
java·linux·c语言·开发语言·c++·面试
mister_guo12 小时前
Java线程池参数应该如何设置(ThreadPoolExecutor)
java