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

相关推荐
黒亱中旳7 小时前
Java AI 框架三国杀:Solon AI vs Spring AI vs LangChain4j 深度对比
java·人工智能·spring
网络工程小王7 小时前
[智能对话系统架构设计文档]
java·系统架构·langraph
alxraves7 小时前
医用超声远程会诊系统:会诊平台的核心架构与功能解析
java·人工智能·架构
带刺的坐椅7 小时前
用 Solon AI ReActAgent 落地智能客服工单处理
java·ai·llm·agent·solon·react-agent
我是坏垠8 小时前
Crypto、Cipher与Password:Java加密开发的三个核心概念
java·开发语言·python
white_ant8 小时前
JDK LTS 版本升级迁移注意事项大全
java·开发语言
Bobolink_9 小时前
跨境业务网络环境评估,“干净、一致、独享”三个关键指标
开发语言·网络·php·跨境网络·网络环境
你怎么知道我是队长9 小时前
JavaScript的变量和数据类型介绍
开发语言·javascript·ecmascript
xingke9 小时前
C 语言多文件编程:(一)头文件、extern、编译链接
c语言·开发语言·多文件
戮漠summer10 小时前
Missing Semester 计算机教育中缺失的一课 Lecture 01 Shell
开发语言·后端·scala