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

相关推荐
wjs20241 小时前
JavaScript 条件语句
开发语言
lulu12165440781 小时前
Claude Code Harness架构技术深度解析:生产级AI Agent工程化实践
java·人工智能·python·ai编程
阿里加多1 小时前
第 1 章:Go 并发编程概述
java·开发语言·数据库·spring·golang
一 乐1 小时前
物流信息管理|基于springboot + vue物流信息管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·物流信息管理系统
2301_792674862 小时前
java学习day29(juc)
java·开发语言·学习
周末也要写八哥2 小时前
MATLAB R2025a超详细下载与安装教程(附安装包)
开发语言·matlab
希望永不加班2 小时前
SpringBoot 自动配置类加载顺序与优先级
java·spring boot·后端·spring·mybatis
纸鸢|3 小时前
从“一锤子买卖“到“持续价值共生“:物联网软件产品如何做到“叫好又叫座“
java·物联网·struts
blog_wanghao3 小时前
基于Qt的串口调试助手
开发语言·qt