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

相关推荐
uzong5 分钟前
程序员从大厂回重庆工作一年
java·后端·面试
kyle~9 分钟前
C++---value_type 解决泛型编程中的类型信息获取问题
java·开发语言·c++
NiNi_suanfa3 小时前
【Qt】Qt 批量修改同类对象
开发语言·c++·qt
小糖学代码3 小时前
LLM系列:1.python入门:3.布尔型对象
linux·开发语言·python
Data_agent4 小时前
1688获得1688店铺详情API,python请求示例
开发语言·爬虫·python
妖灵翎幺4 小时前
C++ 中的 :: 操作符详解(一切情况)
开发语言·c++·ide
开心香辣派小星4 小时前
23种设计模式-15解释器模式
java·设计模式·解释器模式
Halo_tjn4 小时前
虚拟机相关实验概述
java·开发语言·windows·计算机
star _chen4 小时前
C++实现完美洗牌算法
开发语言·c++·算法
周杰伦fans5 小时前
pycharm之gitignore设置
开发语言·python·pycharm