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

相关推荐
编程(变成)小辣鸡1 分钟前
JVM、JRE和JDK 的关系
java·开发语言·jvm
lbb 小魔仙13 分钟前
【Java】Spring Cloud 微服务系统搭建:核心组件 + 实战项目,一步到位
java·spring cloud·微服务
Y_0320 分钟前
SpringBoot+VUE3的图书管理系统
vue.js·spring boot·毕业设计·数据可视化
a程序小傲20 分钟前
得物Java面试被问:流批一体架构的实现和状态管理
java·开发语言·数据库·redis·缓存·面试·架构
xb113221 分钟前
C#异步编程入门概念及核心概念
开发语言·c#
黎雁·泠崖24 分钟前
Java继承:成员变量访问(就近原则+this/super用法)
java·开发语言
别或许37 分钟前
python中的异步调用(直接使用教程)
java·前端·python
ShineWinsu39 分钟前
对于C++:模版初阶的解析
开发语言·c++·面试·笔试·函数··模版
CodeAmaz43 分钟前
文件断点续传完整方案
java·文件断点上传
Max_uuc43 分钟前
【C++ 硬核】告别 Excel 生成数组:利用 constexpr 实现编译期计算查找表 (LUT)
开发语言·c++·excel