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

相关推荐
想带你从多云到转晴13 小时前
优选算法---双指针
java·算法
三品吉他手会点灯13 小时前
C语言学习笔记 - 32.嵌入式C语言学习阶段对初学编程者的建议
c语言·开发语言·笔记·学习
l1t13 小时前
DeepSeek总结的一种带宽高效的压缩基数排序FractalSortCPU
开发语言·python
沐知全栈开发13 小时前
jEasyUI 树形网格动态加载详解
开发语言
Java源头13 小时前
PHP 身份证二要素检测
开发语言·php
闲适达人13 小时前
nginx传递url的获取方案
java·服务器·前端
折哥的程序人生 · 物流技术专研13 小时前
《Java 100 天进阶之路》第21篇:Java Object类
java·开发语言·后端·面试·哈希算法
谙弆悕博士13 小时前
快速学C语言——第17章:多文件编程与头文件规范
c语言·开发语言·算法·学习方法·头文件·多文件编程
熊猫_豆豆13 小时前
仿真模拟两颗卫星的自主交会对接过程(Python版)
开发语言·python
三品吉他手会点灯14 小时前
C语言学习笔记 - 31.数据类型 - 基本输入输出函数printf与scanf
c语言·开发语言·笔记·学习