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

相关推荐
Teln_小凯9 分钟前
Python读取阿里法拍网的html+解决登录cookie
开发语言·python·html
娃哈哈哈哈呀10 分钟前
html-pre标签
java·前端·html
LanLance12 分钟前
ES101系列09 | 运维、监控与性能优化
java·运维·后端·elasticsearch·云原生·性能优化·golang
Java永无止境12 分钟前
Web前端基础:HTML-CSS
java·前端·css·html·javaweb
Tiger Z14 分钟前
R 语言科研绘图第 55 期 --- 网络图-聚类
开发语言·r语言·贴图
love530love34 分钟前
【笔记】旧版MSYS2 环境中 Rust 升级问题及解决过程
开发语言·人工智能·windows·笔记·python·rust·virtualenv
clk66071 小时前
Spring Boot
java·spring boot·后端
扣丁梦想家1 小时前
✅ 常用 Java HTTP 客户端汇总及使用示例
java·开发语言·http
Code_流苏1 小时前
C++课设:智能优惠快餐点餐系统
开发语言·c++·课设·期末大作业·快餐点餐系统·智能优惠算法
爱敲代码的TOM1 小时前
基于JWT+SpringSecurity整合一个单点认证授权机制
spring boot