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

相关推荐
hunjinYang几秒前
使用嵌入式 Tomcat 创建Java Web应用程序
java·tomcat
Godson_beginner13 分钟前
Elasticsearch 学习笔记
java·大数据·elasticsearch·搜索引擎
2501_9466756417 分钟前
Flutter与OpenHarmony打卡步进器组件
java·javascript·flutter
未来之窗软件服务17 分钟前
幽冥大陆(八十五)Python 水果识别ONNX转手机mobile —东方仙盟练气期
开发语言·python·模型训练·仙盟创梦ide·东方仙盟
莓有烦恼吖20 分钟前
基于AI图像识别与智能推荐的校园食堂评价系统研究 05-审核机制模块
java·服务器·python
开开心心就好21 分钟前
OCR识别工具可加AI接口,快捷键截图翻译便捷
java·网络·windows·随机森林·电脑·excel·推荐算法
CSDN_RTKLIB24 分钟前
【类定义系列六】C++17新特性
开发语言·c++
!停31 分钟前
C语言顺序表
c语言·开发语言
你怎么知道我是队长35 分钟前
python---新年烟花
开发语言·python·pygame
智算菩萨40 分钟前
【Python机器学习】主成分分析(PCA):高维数据的“瘦身术“
开发语言·python·机器学习