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 分钟前
远程办公场景 NFA:从网络嗅探与局域网流量监控软件排查团队网络卡顿问题
运维·服务器·开发语言·网络·自动化·php
txinyu的博客5 分钟前
C++ 智能指针 (shared_ptr/weak_ptr) 全解析
开发语言·c++
没有bug.的程序员9 分钟前
Java内存模型(JMM)深度解析:从 volatile 到 happens-before 的底层机制
java·开发语言·并发编程·volatile·内存模型·jmm·happens-before
雨中飘荡的记忆10 分钟前
Java注解校验实战
java
心丑姑娘14 分钟前
怎么理解ClickHouse的向量化执行
java·服务器·clickhouse
寻星探路16 分钟前
【算法进阶】滑动窗口与前缀和:从“和为 K”到“最小覆盖子串”的极限挑战
java·开发语言·c++·人工智能·python·算法·ai
嘿嘿潶黑黑20 分钟前
Qt中的Q_PROPERTY宏
开发语言·qt
DCTANT20 分钟前
【原创】使用更优雅的方式改造MyBatisPlus逻辑删除插件
spring boot·后端·mysql·kotlin·mybatis·mybatisplus
一个帅气昵称啊21 分钟前
C# 14 中的新增功能
开发语言·c#
阿蒙Amon22 分钟前
C#每日面试题-简述C#构造函数和析构函数
java·开发语言·c#