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

相关推荐
Kuo-Teng几秒前
LeetCode 206: Reverse Linked List
java·算法·leetcode·职场和发展
yaoxin5211231 分钟前
237. Java 集合 - 对 List 元素进行排序
java·windows
yaoxin5211236 分钟前
236. Java 集合 - 使用索引访问 List 元素
java·windows·list
humors22137 分钟前
服务端开发案例(不定期更新)
java·数据库·后端·mysql·mybatis·excel
百***68041 小时前
JavaWeb项目打包、部署至Tomcat并启动的全程指南(图文详解)
java·tomcat
庸子1 小时前
Kubernetes调度器深度解析:从资源分配到亲和性策略的架构师之路
java·算法·云原生·贪心算法·kubernetes·devops
Alberta ゙1 小时前
C++初阶
开发语言·c++
the白勺1 小时前
RabbitMQ-基础-总结
开发语言·c#
码码哈哈0.01 小时前
Vue 3 + Vite 集成 Spring Boot 完整部署指南 - 前后端一体化打包方案
前端·vue.js·spring boot
Dev7z2 小时前
基于Matlab多目标粒子群优化的无人机三维路径规划与避障研究
开发语言·matlab·无人机