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

相关推荐
Libby博仙1 天前
Spring Boot 条件化注解深度解析
java·spring boot·后端
willingli1 天前
c语言经典100题 61-70题
c语言·开发语言·算法
我是小疯子661 天前
深入解析C++右值引用与移动语义
java·开发语言·算法
Ethan Wilson1 天前
VS2019 C++20 模块相关 C1001: 内部编译器错误
开发语言·c++·c++20
better_liang1 天前
每日Java面试场景题知识点之-JUC锁的底层原理
java·并发编程·juc·锁机制·reentrantlock·readwritelock·底层原理
郝学胜-神的一滴1 天前
Python数据封装与私有属性:保护你的数据安全
linux·服务器·开发语言·python·程序人生
悟能不能悟1 天前
Elastic Stack 中两种主要查询语言 KQL (Kibana Query Language) 和 Lucene 的详细对比和解释。
java·开发语言
我是一只小青蛙8881 天前
Java连接MySQL数据库实战指南
java
夏末4721 天前
Java异常处理终极指南:从入门到企业级实战,让程序稳如老狗!
java·java ee
子非鱼9211 天前
SpringBoot快速上手
java·spring boot·后端