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

相关推荐
房开民9 小时前
c++总结
java·开发语言·c++
好大哥呀10 小时前
C++ 多态
java·jvm·c++
毕设源码-赖学姐10 小时前
【开题答辩全过程】以 基于Java的医院器材管理系统的设计与实现为例,包含答辩的问题和答案
java·开发语言
float_com10 小时前
【java常用API】----- Arrays
java·开发语言
皮皮林55110 小时前
用 SpringBoot + Tess4j 优雅实现图像文字识别,真香!
spring boot
不会写DN10 小时前
PHP 中的文件读写与上传
android·开发语言·php
LuckyTHP11 小时前
迁移shibboleth java获取shibboleth用户信息
java·开发语言
客卿12311 小时前
数论===质数统计(暴力法,)
java·开发语言
Σίσυφος190011 小时前
C++ 多肽经典面试题
开发语言·c++·面试
华科易迅11 小时前
Spring 事务(注解)
java·数据库·spring