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

相关推荐
IMPYLH3 分钟前
Lua 的 OS(操作系统) 模块
开发语言·笔记·后端·游戏引擎·lua
YGGP10 分钟前
【Golang】LeetCode 287. 寻找重复数
开发语言·leetcode·golang
吴佳浩 Alben12 分钟前
Go 1.22 通关讲解
开发语言·数据库·golang
黎雁·泠崖13 分钟前
指针家族高阶篇:字符指针、数组指针、函数指针及转移表应用
c语言·开发语言
小年糕是糕手15 分钟前
【C/C++刷题集】string类(一)
开发语言·数据结构·c++·算法·leetcode
a努力。25 分钟前
国家电网Java面试被问:二叉树的前序、中序、后序遍历
java·开发语言·后端·面试
JAVA+C语言29 分钟前
C++ 继承与派生
开发语言·c++
fiveym35 分钟前
PXE启动菜单配置完全指南:打造高效网络装机入口
开发语言·网络·php
賬號封禁中miu37 分钟前
图论之最小生成树
java·数据结构·算法·图论
月明长歌38 分钟前
Java数据结构:PriorityQueue堆与优先级队列:从概念到手写大根堆
java·数据结构·python·leetcode·