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

相关推荐
麦兜*2 分钟前
SpringBoot 3.x新特性全面解析:从Java 17支持到GraalVM原生镜像
java·spring boot·后端
一行注释8 分钟前
ECharts柱状图横向展示与DataZoom滑动查看实现
开发语言·前端·javascript
Ulyanov26 分钟前
Impress.js深度解析
开发语言·前端·javascript·css3·impress.js
醇氧29 分钟前
Spring WebFlux 学习
java·学习·spring
烤麻辣烫29 分钟前
23种设计模式(新手)-9单例模式
java·开发语言·学习·设计模式·intellij-idea
ytttr87331 分钟前
基于MATLAB实现时间序列小波相干性分析
开发语言·matlab
资生算法程序员_畅想家_剑魔38 分钟前
Java常见技术分享-设计模式的六大原则
java·开发语言·设计模式
Howrun7771 小时前
C++ 智能指针_详细解释
开发语言
Cherry的跨界思维1 小时前
【AI测试全栈:质量】40、数据平权之路:Python+Java+Vue全栈实战偏见检测与公平性测试
java·人工智能·python·机器学习·ai测试·ai全栈·ai测试全栈
刀法如飞1 小时前
从零手搓一个类Spring框架,彻底搞懂Spring核心原理
java·设计模式·架构设计