尚硅谷SpringMVC (5-8)
五、域对象共享数据
1、使用ServletAPI向request域对象共享数据
首页:
@Controller
public class TestController {@RequestMapping("/")public String index(){return "index";}
}
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>首页</title>
</head>
<body>
<h1>您已进入首页!</h1><a th:href="@{/testRequestByServletAPI}">通过servletAPI向request域对象共享数据</a>
</body>
</html>
跳转页:
@Controller
public class ScopeController {//使用servletAPI向request域对象共享数据@RequestMapping("/testRequestByServletAPI")public String testRequestByServletAPI(HttpServletRequest request){//共享数据。参数一个是键,一个是值request.setAttribute("testRequestScope","hello,servletAPI");return "success";}
}
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<p th:text="${testRequestScope}"></p></body>
</html>


2、使用ModelAndView向request域对象共享数据
@RequestMapping("/testModelAndView")//必须使用ModelAndView作为该方法的返回值返回public ModelAndView testModelAndView(){ModelAndView mav = new ModelAndView();//处理模型数据,即向请求域request共享数据mav.addObject("testRequestScope","hello,ModelAndView");//设置视图名称mav.setViewName("success");return mav;}
<a th:href="@{/testModelAndView}">通过ModelAndView向request域对象共享数据</a><br>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<p th:text="${testRequestScope}"></p></body>
</html>


3、使用Model向request域对象共享数据
@RequestMapping("/testModel")public String testModel(Model model){model.addAttribute("testRequestScope","hello,model");return "success";}
<a th:href="@{/testModel}">通过Model向request域对象共享数据</a><br>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<p th:text="${testRequestScope}"></p></body>
</html>


4、使用map向request域对象共享数据
@RequestMapping("/testMap")public String testMap(Map<String, Object> map){map.put("testRequestScope","hello,map");return "success";}
<a th:href="@{/testMap}">通过Map向request域对象共享数据</a><br>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<p th:text="${testRequestScope}"></p></body>
</html>

5、使用ModelMap向request域对象共享数据
@RequestMapping("/testModelMap")public String testModelMap(ModelMap modelMap){modelMap.addAttribute("testRequestScope","hello,ModelMap");return "success";}
<a th:href="@{/testModelMap}">通过ModelMap向request域对象共享数据</a><br>
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<p th:text="${testRequestScope}"></p></body>
</html>


6、Model、ModelMap、Map的关系
publicinterfaceModel{}public class LinkedHashMap<K,V>extends HashMap<K,V> implements Map<K,V>publicclassModelMapextendsLinkedHashMap<String,Object>{}publicclassExtendedModelMapextendsModelMapimplementsModel{}publicclassBindingAwareModelMapextendsExtendedModelMap{}
7、向session域共享数据
@RequestMapping("/testSession")public String testSession(HttpSession session){session.setAttribute("testSessionScope","hello,Session");return "success";} <a th:href="@{/testSession}">通过ServletAPI向session域对象共享数据</a><br> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<!--<p th:text="${testRequestScope}"></p>-->
<p th:text="${session.testSessionScope}"></p></body>
</html> 

8、向application域共享数据
@RequestMapping("/testApplication")public String testApplication(HttpSession session){ServletContext application = session.getServletContext();application.setAttribute("testApplicationScope","hello,Application");return "success";} <a th:href="@{/testApplication}">通过ServletAPI向Application域对象共享数据</a><br> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<h1>跳转成功!</h1><br>
<!--<p th:text="${testRequestScope}"></p>-->
<!--<p th:text="${session.testSessionScope}"></p>-->
<p th:text="${application.testApplicationScope}"></p></body>
</html> 

六、SpringMVC的视图
1、ThymeleafView
@Controller
public class ViewController {@RequestMapping("/testThymeleafView")public String testThymeleafView(){return "success";}
} <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<a th:href="@{/testThymeleafView}">测试ThymeleafView</a>
</body>
</html> 
2、转发视图
@RequestMapping("/testForward")public String testForward(){return "forward:/testThymeleafView";} <a th:href="@{/testForward}">测试InternalResourceView</a><br> 
3、重定向视图
@RequestMapping("/testRedirect")public String testRedirect(){return "redirect:/testThymeleafView";}
<a th:href="@{/testRedirect}">测试RedirectView</a><br>

注:重定向视图在解析时,会先将 redirect: 前缀去掉,然后会判断剩余部分是否以 / 开头,若是则会自动拼接上下文路径
转发和重定向的区别?
参考连接:https://www.cnblogs.com/qzhc/p/11313879.html
4、视图控制器view-controller
<!--path:设置处理的请求地址view-name:设置请求地址所对应的视图名称--><mvc:view-controller path="/" view-name="index"></mvc:view-controller><!--开启MVC的注解驱动--><mvc:annotation-driven/>
注:当 SpringMVC 中设置任何一个 view-controller 时,其他控制器中的请求映射将全部失效,此时需要在SpringMVC 的核心配置文件中设置开启 mvc 注解驱动的标签:<mvc:annotation-driven />
七、RESTful
1、RESTful简介
2、RESTful的实现
@Controller
public class UserController {//使用RESTFul模拟用户资源的增删改查// /user GET 查询所有用户// /user/1 GET 根据用户id查询用户信息// /user POST 添加用户信息// /user DELETE 删除用户信息// /user PUT 更新用户信息@RequestMapping(value = "/user",method = RequestMethod.GET)public String getAllUser(){System.out.println("查询所有用户");return "success";}@RequestMapping(value = "/user/{id}",method = RequestMethod.GET)public String getUserById(){System.out.println("根据用户id查询用户信息");return "success";}@RequestMapping(value = "/user",method = RequestMethod.POST)public String insertUser(String username,String password){System.out.println("添加用户信息:"+username+","+password);return "success";}
}
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body>
<a th:href="@{/user}">查询所有用户</a><br>
<a th:href="@{/user/1}">根据id查询用户信息</a><br>
<form th:action="@{/user}" method="post">用户名:<input type="text" name="username"><br>密码: <input type="text" name="password"><br><input type="submit" value="添加"><br>
</form>
</body>
</html>
<!--path:设置处理的请求地址view-name:设置请求地址所对应的视图名称--><mvc:view-controller path="/" view-name="index"></mvc:view-controller><mvc:view-controller path="/test_view" view-name="test_view"></mvc:view-controller><mvc:view-controller path="/test_rest" view-name="test_rest"></mvc:view-controller><!--开启MVC的注解驱动--><mvc:annotation-driven/>


3、HiddenHttpMethodFilter
<!--配置HiddenHttpMethodFilter--><filter><filter-name>HiddenHttpMethodFilter</filter-name><filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class></filter><filter-mapping><filter-name>HiddenHttpMethodFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping> 注:目前为止, SpringMVC 中提供了两个过滤器: CharacterEncodingFilter 和HiddenHttpMethodFilter在 web.xml 中注册时,必须先注册 CharacterEncodingFilter ,再注册 HiddenHttpMethodFilter原因:
- 在 CharacterEncodingFilter 中通过 request.setCharacterEncoding(encoding) 方法设置字符集的
- request.setCharacterEncoding(encoding) 方法要求前面不能有任何获取请求参数的操作
- 而 HiddenHttpMethodFilter 恰恰有一个获取请求方式的操作:
- String paramValue = request.getParameter(this.methodParam);
@RequestMapping(value = "/user",method = RequestMethod.PUT)public String updateUser(String username,String password){System.out.println("更新用户信息"+username+","+password);return "success";}@RequestMapping(value = "/user/{id}",method = RequestMethod.DELETE)public String deleteUser(String username,String password){System.out.println("删除用户信息"+username+","+password);return "success";}
<form th:action="@{/user}" method="post"><input type="hidden" name="_method" value="PUT" >用户名:<input type="text" name="username"><br>密码: <input type="text" name="password"><br><input type="submit" value="修改"><br>
</form><br><form th:action="@{/user/1}" method="post"><input type="hidden" name="_method" value="DELETE" >用户名:<input type="text" name="username"><br>密码: <input type="text" name="password"><br><input type="submit" value="删除"><br>


八、RESTful案例
1、准备工作
- 搭建环境
- 准备实体类
public class Employee {private Integer id;private String lastName;private String email;private Integer gender;public Employee() {}public Employee(Integer id, String lastName, String email, Integer gender) {this.id = id;this.lastName = lastName;this.email = email;this.gender = gender;}//get,set,toString方法
}
- 准备dao模拟数据
@Repository
public class EmployeeDao {private static Map<Integer, Employee> employees = null;static{employees = new HashMap<Integer, Employee>();employees.put(1001, new Employee(1001, "E-AA", "aa@163.com", 1));employees.put(1002, new Employee(1002, "E-BB", "bb@163.com", 1));employees.put(1003, new Employee(1003, "E-CC", "cc@163.com", 0));employees.put(1004, new Employee(1004, "E-DD", "dd@163.com", 0));employees.put(1005, new Employee(1005, "E-EE", "ee@163.com", 1));}private static Integer initId = 1006;public void save(Employee employee){if(employee.getId() == null){employee.setId(initId++);}employees.put(employee.getId(), employee);}public Collection<Employee> getAll(){return employees.values();}public Employee get(Integer id){return employees.get(id);}public void delete(Integer id){employees.remove(id);}
}
2、功能清单

3、具体功能:访问首页
<!--配置视图控制器--><mvc:view-controller path="/" view-name="index"></mvc:view-controller><!--开启mvc注解驱动--><mvc:annotation-driven/> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>首页</title>
</head>
<body>
<h1>首页</h1>
<a th:href="@{/employee}">查看员工信息</a></body>
</html> 4、具体功能:查询所有员工数据
@Controller
public class EmployeeController {@Autowiredprivate EmployeeDao employeeDao;@RequestMapping(value = "/employee",method = RequestMethod.GET)public String getAllEmployee(Model model){Collection<Employee> employeeList = employeeDao.getAll();model.addAttribute("employeeList",employeeList);return "employee_list";}} <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Employee Info</title>
</head>
<body>
<table border="1" cellspacing="0" style="text-align: center"><tr><th colspan="5">Employee Info</th></tr><tr><th>id</th><th>lastName</th><th>email</th><th>gender</th><th>options</th></tr><tr th:each="employee:${employeeList}"><td th:text="${employee.id}"></td><td th:text="${employee.lastName}"></td><td th:text="${employee.email}"></td><td th:text="${employee.gender}"></td><td><a href="">delete</a><a href="">update</a></td></tr>
</table></body>
</html> 5、具体功能:删除
<!-- 作用:通过超链接控制表单的提交,将post请求转换为delete请求 --><form id="deleteForm" method="post"><!-- HiddenHttpMethodFilter要求:必须传输_method请求参数,并且值为最终的请求方式 --><input type="hidden" name="_method" value="delete"></form> <script type="text/javascript" th:src="@{/static/js/vue.js}"></script> <a @click="deleteEmployee" th:href="@{/employee/}+${employee.id}">delete</a> <script type="text/javascript">var vue = new Vue({el:"#dataTable",methods:{deleteEmployee:function (event){//根据id获取表单元素var deleteForm = document.getElementById("deleteForm");//将触发点击事件的超链接的href属性赋值给表达的actiondeleteForm.action=event.target.href;//提交表单deleteForm.submit();//取消超链接的默认行为event.preventDefault();}}});</script>
@RequestMapping(value = "/employee/{id}",method = RequestMethod.DELETE)public String deleteEmployee(@PathVariable("id") Integer id){employeeDao.delete(id);return "redirect:/employee";} 6、具体功能:跳转到添加数据页面
a>添加add连接
<th>options (<a th:href="@{/toAdd}">add</a> )</th> <mvc:view-controller path="/toAdd" view-name="employee_add"></mvc:view-controller> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>add employee</title>
</head>
<body><form th:action="@{/employee}" method="post">lastName: <input type="text" name="lastName"><br>email: <input type="text" name="email"><br>gender: <input type="radio" name="gender" value="1">male<br>gender: <input type="radio" name="gender" value="0">female<br><input type="submit" value="add"><br>
</form></body>
</html> d>控制器方法
@RequestMapping(value = "/employee",method = RequestMethod.POST)public String addEmployee(Employee employee){employeeDao.save(employee);return "redirect:/employee";} 8、具体功能:跳转到更新数据页面
<a th:href="@{/employee/}+${employee.id}">update</a> @RequestMapping(value = "/employee/{id}",method = RequestMethod.GET)public String getEmployeeById(@PathVariable("id") Integer id, Model model){Employee employee = employeeDao.get(id);model.addAttribute("employee",employee);return "employee_update";} <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>update employee</title>
</head>
<body>
<form th:action="@{/employee}" method="post"><input type="hidden" name="_method" value="put"><input type="hidden" name="id" th:value="${employee.id}">lastName: <input type="text" name="lastName" th:value="${employee.lastName}"><br>email: <input type="text" name="email" th:value="${employee.email}"><br>gender: <input type="radio" name="gender" value="1" th:field="${employee.gender}">male<br>gender: <input type="radio" name="gender" value="0" th:field="${employee.gender}">female<br><input type="submit" value="update"><br>
</form></body>
</html> @RequestMapping(value = "/employee",method = RequestMethod.PUT)public String updateEmployee(Employee employee){employeeDao.save(employee);return "redirect:/employee";}
相关文章:
尚硅谷SpringMVC (5-8)
五、域对象共享数据 1、使用ServletAPI向request域对象共享数据 首页: Controller public class TestController {RequestMapping("/")public String index(){return "index";} } <!DOCTYPE html> <html lang"en" xmln…...
jupyter notebook中查看python版本的解决方案
大家好,我是爱编程的喵喵。双985硕士毕业,现担任全栈工程师一职,热衷于将数据思维应用到工作与生活中。从事机器学习以及相关的前后端开发工作。曾在阿里云、科大讯飞、CCF等比赛获得多次Top名次。现为CSDN博客专家、人工智能领域优质创作者。喜欢通过博客创作的方式对所学的…...
动态字符串 String (完整源码)
C自学精简教程 目录(必读) C数据结构与算法实现(目录) 本文的实现基本上和 动态数组 vector 是一样的。 因为大部分接口都一样。 所以,本文就直接给出全部的源码和运行结果。 //------下面的代码是用来测试你的代码有没有问题的辅助代码…...
【深度学习】实验05 构造神经网络示例
文章目录 构造神经网络1. 导入相关库2. 定义一个层3. 构造数据集4. 定义基本模型5. 变量初始化6. 开始训练 构造神经网络 注明:该代码用来训练一个神经网络,网络拟合y x^2-0.5noise,该神经网络的结构是输入层为一个神经元,隐藏层…...
用了这么久SpringBoot却还不知道的一个小技巧
前言 你可能调第三方接口喜欢启动application,修改,再启动,再修改,顺便还有个不喜欢写JUnitTest的习惯。 你可能有一天想要在SpringBoot启动后,立马想要干一些事情,现在没有可能是你还没遇到。 那么SpringB…...
Websocket、SessionCookie、前端基础知识
目录 1.Websocket Websocket与HTTP的介绍 不同使用场景 Websocket链接过程 2.Session&Cookie Cookie的工作原理 Session的工作原理 区别 3.前端基础知识 1.Websocket Websocket与HTTP的介绍 HTTP: 1.HTTP是单向的,客户端发送请求࿰…...
【云原生进阶之PaaS中间件】第一章Redis-2.4缓存更新机制
1 缓存和数据库的数据一致性分析 1.1 Redis 中如何保证缓存和数据库双写时的数据一致性? 无论先操作db还是cache,都会有各自的问题,根本原因是cache和db的更新不是一个原子操作,因此总会有不一致的问题。想要彻底解决这种问题必须…...
Qt——事件处理详解
Qt事件处理 一、事件基础 事件是Qt应用程序中的基本构建块,它们代表了一些特定的行为或状态变化。事件可以是鼠标点击、键盘输入、窗口大小改变、定时器事件等。每个事件都是一个对象,继承自QEvent类。 二、事件常见类型 Qt中的事件分为多种类型&…...
基于位置管理的企业员工考勤打卡系统设计 微信小程序
员工考勤打卡系统设计app是针对员工必不可少的一个部分。在公司发展的整个过程中,员工考勤打卡系统设计app担负着最重要的角色。为满足如今日益复杂的管理需求,各类员工考勤打卡系统设计app程序也在不断改进。本课题所设计的 MVC基于HBuilder X的员工考勤…...
adb 查找应用包名,应用 Activity 等信息
列出设备上的包 不使用参数:adb shell pm list packages,打印设备/模拟器上的所有软件包 根据包名查看应用的activity 命令: dumpsys package 包名 adb shell dumpsys package 包名 petrel-cv96d:/data/app # dumpsys package com.instal…...
八、SpringBoot集成Kafka
目录 一、添加依赖二、SpringBoot 生产者三、SpringBoot 消费者 一、添加依赖 <dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><depend…...
联网智能实时监控静电离子风机的工作流程
联网智能实时监控静电离子风机是通过将静电离子风机与互联网连接,实现对其状态和性能的远程监控和管理。 具体实现该功能的方法可以包括以下几个步骤: 1. 传感器安装:在静电离子风机上安装适当的传感器,用于感知相关的参数&…...
第12章 微信支付
mini商城第12章 微信支付 一、课题 微信支付 二、回顾 1、分布式事务 2、分布式事务理论 3、掌握分布式事务解决方案模型 4、能基于Seata解决强一致性分布式事务 5、能基于RocketMQ解决柔性事务 三、目标 1、密码安全学 摘要加密 Base64 对称加密 2、微信支付 微信支…...
Java基础二十二(对集合元素排序比较)
对集合元素排序比较 1. 使用 Comparable 接口实现默认排序 Comparable 是 Java 中的一个接口,用于定义对象之间的排序规则。 实现了 Comparable 接口的类可以比较其对象的大小(包装类都实现了该接口),从而可以在集合类…...
(15)线程的实例认识:同步,异步,并发,并发回调,事件,异步线程,UI线程
参看:https://www.bilibili.com/video/BV1xA411671D/?spm_id_from333.880.my_history.page.click&vd_source2a0404a7c8f40ef37a32eed32030aa18 下面是net framework版本 一、文件构成 1、界面如下。 (1)同步与异步有什么区别? …...
长胜证券:华为“黑科技”点燃A股炒作激情
8月29日,在未举行相关发布会的情况下,华为新款手机Mate60Pro悄然上线开售,并在一小时内售罄。 金融出资报记者注意到,跟着商场对新机重视的继续发酵,其中的各种技能打破也愈加受到重视,其影响很快扩散到资…...
Kubernetes(k8s)上部署redis5.0.14
Kubernetes上部署redis 环境准备创建命名空间 准备PV和PVC安装nfs准备PV准备PVC 部署redis创建redis的配置文件部署脚本挂载数据目录挂载配置文件通过指定的配置文件启动redis 集群内部访问外部链接Redis 环境准备 首先你需要一个Kubernetes环境,可参考我写的文章&…...
frida动态调试入门01——定位关键代码
说明 frida是一款Python工具可以方便对内存进行hook修改代码逻辑在移动端安全和逆向过程中常用到。 实战 嘟嘟牛登录页面hook 使用到的工具 1,jadx-gui 2,frida 定位关键代码 使用jadx-gui 进行模糊搜索,例如搜索encyrpt之类的加密关键…...
ASP.NET Core 8 的配置类 Configuration
Configuration Configuration 可以从两个途径设置: WebApplication创建的对象app.Configuration 属性WebApplicationBuilder 创建的 builder.Configuration 属性 app的Configuration优先级更高,host Configuration作为替补配置,因为app运行…...
MySql增量恢复
一、 使用二进制日志的时间点恢复 注意 本节和下一节中的许多示例都使用mysql客户端来处理mysqlbinlog生成的二进制日志输出。如果您的二进制日志包含\0(null)字符,那么mysql将无法解析该输出,除非您使用--binary模式选项调用它。…...
(十)学生端搭建
本次旨在将之前的已完成的部分功能进行拼装到学生端,同时完善学生端的构建。本次工作主要包括: 1.学生端整体界面布局 2.模拟考场与部分个人画像流程的串联 3.整体学生端逻辑 一、学生端 在主界面可以选择自己的用户角色 选择学生则进入学生登录界面…...
VB.net复制Ntag213卡写入UID
本示例使用的发卡器:https://item.taobao.com/item.htm?ftt&id615391857885 一、读取旧Ntag卡的UID和数据 Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click轻松读卡技术支持:网站:Dim i, j As IntegerDim cardidhex, …...
Python:操作 Excel 折叠
💖亲爱的技术爱好者们,热烈欢迎来到 Kant2048 的博客!我是 Thomas Kant,很开心能在CSDN上与你们相遇~💖 本博客的精华专栏: 【自动化测试】 【测试经验】 【人工智能】 【Python】 Python 操作 Excel 系列 读取单元格数据按行写入设置行高和列宽自动调整行高和列宽水平…...
(二)TensorRT-LLM | 模型导出(v0.20.0rc3)
0. 概述 上一节 对安装和使用有个基本介绍。根据这个 issue 的描述,后续 TensorRT-LLM 团队可能更专注于更新和维护 pytorch backend。但 tensorrt backend 作为先前一直开发的工作,其中包含了大量可以学习的地方。本文主要看看它导出模型的部分&#x…...
使用分级同态加密防御梯度泄漏
抽象 联邦学习 (FL) 支持跨分布式客户端进行协作模型训练,而无需共享原始数据,这使其成为在互联和自动驾驶汽车 (CAV) 等领域保护隐私的机器学习的一种很有前途的方法。然而,最近的研究表明&…...
三体问题详解
从物理学角度,三体问题之所以不稳定,是因为三个天体在万有引力作用下相互作用,形成一个非线性耦合系统。我们可以从牛顿经典力学出发,列出具体的运动方程,并说明为何这个系统本质上是混沌的,无法得到一般解…...
JUC笔记(上)-复习 涉及死锁 volatile synchronized CAS 原子操作
一、上下文切换 即使单核CPU也可以进行多线程执行代码,CPU会给每个线程分配CPU时间片来实现这个机制。时间片非常短,所以CPU会不断地切换线程执行,从而让我们感觉多个线程是同时执行的。时间片一般是十几毫秒(ms)。通过时间片分配算法执行。…...
项目部署到Linux上时遇到的错误(Redis,MySQL,无法正确连接,地址占用问题)
Redis无法正确连接 在运行jar包时出现了这样的错误 查询得知问题核心在于Redis连接失败,具体原因是客户端发送了密码认证请求,但Redis服务器未设置密码 1.为Redis设置密码(匹配客户端配置) 步骤: 1).修…...
推荐 github 项目:GeminiImageApp(图片生成方向,可以做一定的素材)
推荐 github 项目:GeminiImageApp(图片生成方向,可以做一定的素材) 这个项目能干嘛? 使用 gemini 2.0 的 api 和 google 其他的 api 来做衍生处理 简化和优化了文生图和图生图的行为(我的最主要) 并且有一些目标检测和切割(我用不到) 视频和 imagefx 因为没 a…...
uniapp手机号一键登录保姆级教程(包含前端和后端)
目录 前置条件创建uniapp项目并关联uniClound云空间开启一键登录模块并开通一键登录服务编写云函数并上传部署获取手机号流程(第一种) 前端直接调用云函数获取手机号(第三种)后台调用云函数获取手机号 错误码常见问题 前置条件 手机安装有sim卡手机开启…...
