Java Web实战:利用三层架构与Servlet构建登录注册模块

news2024/9/21 19:06:34

 前言导读

三层架构:View(视图层)Service(业务层)DAO(持久层)

  • 使用了JDBCtemplate技术,封装了原生的JDBC技术操作MySQL数据库(DAO层)
  • 实现了登录功能和注册功能(Service层)
  • 使用Servlet操作前端表单提供的数据,进行登录和注册,以及完成页面跳转的需求实现(View层)

 第一步:创建JavaWeb项目,在pom.xml中配置相关依赖

 pom.xml

        不要把我的项目名也一起复制了,只复制依赖<dependency>和插件部分<build>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.example</groupId>
  <artifactId>maven_9_11</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>maven_9_11 Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <!-- junit单元测试-->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <!--MySQL数据库连接驱动jar包-->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.28</version>
    </dependency>
    <!-- servlet依赖支持-->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    <!--JDBCTemplate依赖支持,因为JDBCTemplate是Spring框架封装的一个工具类,因此需要导入Spring相关依赖-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>5.3.4</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <version>5.3.4</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>5.2.8.RELEASE</version>
    </dependency>

  </dependencies>
  <build>
    <!--配置项目名 -->
    <finalName>web</finalName>
    <plugins>
    <!--配置jetty服务器插件支持-->
    <plugin>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <version>9.3.14.v20161028</version>
    </plugin>
      <!--配置tomcat服务器插件支持-->
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.1</version>
      <configuration>
        <port>8080</port>
        <path>/</path>
        <uriEncoding>UTF-8</uriEncoding>
        <server>tomcat7</server>
      </configuration>
    </plugin>
    </plugins>
  </build>
</project>

第二步:创建数据库表和实体类并导入JDBCTemplate工具类

数据库表t_user:

这里不介绍如何创建这样的一个数据库了(保证user_id为主键即可)

User实体类:

package com.csx.entity;

import java.io.Serializable;

public class User implements Serializable {
    private Integer userId;
    private String userName;
    private String password;

    public User(){}

    public User(Integer userId, String userName, String password) {
        this.userId = userId;
        this.userName = userName;
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", password='" + password + '\'' +
                '}';
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
}

工具类:

package com.csx.util;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.support.TransactionSynchronizationManager;

import javax.sql.DataSource;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;

public class JDBCUtils {
    private static DataSource dataSource =null;

    static{
        try (
                InputStream is=JDBCUtils.class.getResourceAsStream("/JDBCUtils.properties")
        ){
            Properties p = new Properties();
            p.load(is);
            dataSource = new DriverManagerDataSource(p.getProperty("url"), p.getProperty("username"), p.getProperty("password"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    public static JdbcTemplate getJDBCTemplate(){
        //创建JDBCTemplate对象并传入数据库连接池
        JdbcTemplate template = new JdbcTemplate(dataSource);
        return template;
    }

    /**
     * 获取数据库连接池
     * @return
     */
    public static DataSource getDataSource(){
        return dataSource;
    }

    /**
     * 开始线程绑定 +获取连接
     * @return
     */
    public static Connection startTransaction(){
        if (!TransactionSynchronizationManager.isSynchronizationActive()){
            TransactionSynchronizationManager.initSynchronization();
        }
        Connection connection =DataSourceUtils.getConnection(dataSource);
        try {
            connection.setAutoCommit(false);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return connection;
    }

    /**
     * 提交事务
     * @param conn
     */
    public static void commit(Connection conn){
        try {
            conn.commit();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }finally {
            clear(conn);
        }
    }

    /**
     * 回滚事务
     * @param conn
     */
    public static void rollback(Connection conn){
        try {
            conn.rollback();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }finally {
            clear(conn);
        }
    }


    /**
     * 解除线程绑定+释放资源+归还连接到线程池
     * @param conn
     */
    public static void clear(Connection conn){
        //清除线程绑定的资源
        TransactionSynchronizationManager.clear();
        TransactionSynchronizationManager.unbindResourceIfPossible(dataSource);
        //归还数据库连接至连接池
        if (conn!=null){//非空判断,判断为空再归还
            DataSourceUtils.releaseConnection(conn,dataSource);
        }
    }

}

在resources资源目录下创建JDBCUtils.properties目录

JDBCUtils.properties

url=jdbc:mysql://localhost:3306/csx_demo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimeZone=Asia/shanghai
username=root
password=root

第三步:创建DAO层,书写SQL支持

UserDao接口:

package com.csx.dao;

import com.csx.entity.User;

public interface UserDao {
    /**
     * 根据用户名和密码指定用户是否存在
     * @param userName
     * @return
     */
    public User selectUserByUserName(String userName,String password);

    /**
     * 新增用户信息
     * @param user
     * @return
     */
    public int insertUser(User user);

}

UserDaoImpl实现类:

package com.csx.dao.impl;

import com.csx.dao.UserDao;
import com.csx.entity.User;
import com.csx.service.UserService;
import com.csx.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class UserDaoImpl implements UserDao {
    private JdbcTemplate template = JDBCUtils.getJDBCTemplate();


    /**
     * 根据用户名和密码指定用户是否存在
     *
     * @param userName
     * @param password
     * @return
     */
    @Override
    public User selectUserByUserName(String userName, String password) {
        String sql="select * from t_user where user_name=? and password=? ";
        List<User> list = template.query(sql, new BeanPropertyRowMapper<>(User.class), userName, password);
        return list.isEmpty()?null:list.get(0);
    }

    /**
     * 新增用户信息
     *
     * @param user
     * @return
     */
    @Override
    public int insertUser(User user) {
        String sql="insert into t_user(user_name,password) values(?,?)";
        return template.update(sql, user.getUserName(), user.getPassword());
    }
}

第四步:创建Service层,书写登录和注册逻辑

UserService接口:

package com.csx.service;

public interface UserService {


    /**
     * 用户登录功能
     * @param username
     * @param password
     * @return
     */
    public boolean login(String username,String password);

    /**
     * 用户注册功能
     * @return
     */
    public boolean register(String username,String password);
}

UserServiceImpl实现类:

package com.csx.service.impl;

import com.csx.dao.UserDao;
import com.csx.dao.impl.UserDaoImpl;
import com.csx.entity.User;
import com.csx.service.UserService;
import com.csx.util.JDBCUtils;

import java.sql.Connection;

public class UserServiceImpl implements UserService {
    private UserDao userDao =new UserDaoImpl();

    /**
     * 用户登录功能
     *
     * @param username
     * @param password
     * @return
     */
    @Override
    public boolean login(String username, String password) {
        boolean boo =false;
        Connection conn =null;
        try{
            conn= JDBCUtils.startTransaction();
            //业务功能
            User user = userDao.selectUserByUserName(username,password);
            //判断用户名是否存在
            if (user!=null){
                //判断密码是否正确
                if (user.getPassword().equals(password)){
                    boo=true;
                }else {
                    throw new RuntimeException("密码错误!");
                }
            }else {
                throw new RuntimeException("用户不存在!");
            }
            JDBCUtils.commit(conn);
        }catch (Exception e){
            JDBCUtils.rollback(conn);
            throw new RuntimeException(e);
        }
        return boo;

    }

    /**
     * 用户注册功能
     *
     * @param username
     * @param password
     * @return
     */
    @Override
    public boolean register(String username, String password) {
        boolean boo=false;
        Connection conn=null;
        try {
            conn = JDBCUtils.startTransaction();
            //业务功能
            User u = userDao.selectUserByUserName(username,password);
            if (u == null) {
                User user = new User(null, username, password);
                userDao.insertUser(user);
                boo = true;
            } else {
                throw new RuntimeException("用户名重复,注册失败!");
            }
            JDBCUtils.commit(conn);
        }catch (Exception e){
            JDBCUtils.rollback(conn);
            throw  new RuntimeException(e);
        }
        return boo;
    }
}

第五步:书写Servlet接收页面传入的数据,并响应

LoginServlet:

package com.csx.servlet;

import com.csx.service.UserService;
import com.csx.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/login")
public class LoginServlet extends HttpServlet {
    private UserService userService =new UserServiceImpl();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String name = request.getParameter("username");
        String pwd =request.getParameter("password");
        try {
            boolean login = userService.login(name, pwd);
            if (login){
                System.out.println("登录成功!");
                response.sendRedirect("login_success.html");
            }else {

                }
        } catch (Exception e) {
            System.out.println("登录失败");
            response.sendRedirect("login_failed.html");
        }


    }
}

RegisterServlet:

package com.csx.servlet;

import com.csx.service.UserService;
import com.csx.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/register")
public class RegisterServlet extends HttpServlet {
    private UserService userService =new UserServiceImpl();
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String name = request.getParameter("username");
        String pwd =request.getParameter("password");
        try {
            boolean login = userService.register(name, pwd);
            if (login){
                System.out.println("注册成功!");
//                response.sendRedirect("register_success.html");
                response.sendRedirect("register_success.html");
            }
        } catch (Exception e) {
            System.out.println("注册失败!");
            response.sendRedirect("register_failed.html");
        }
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }
}

web.xml配置 

创建一个JavaWeb项目,想要使用注解@WebServlet来配置Servlet路径映射,需要将webapp目录下的WBE-INF目录下的web.xml中配置3.0 以上的配置头,例如:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
         http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

</web-app>

 第六步:在webapp目录下创建HTML页面

login.html:

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Form</title>
    <style>
        /* 简单的样式来美化表单 */
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        .login-form {
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .login-form h2 {
            margin-bottom: 20px;
        }
        .login-form input[type="text"],
        .login-form input[type="password"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-form input[type="submit"] {
            background-color: #ff0000;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-form input[type="submit"]:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>

<div class="login-form">
    <h2>Login</h2>
    <form action="/login" method="post">
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <input type="submit" value="Login">
    </form>
</div>
</body>
</html>

login_success.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>登录成功!</h1>
</body>
<script>alert('登录成功!')</script>
</html>

login_failed:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>登录失败</h1>
</body>
<script>
    alert('登录失败')
</script>
</html>

register.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registration Form</title>
    <style>
        /* 简单的样式来美化表单 */
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        .registration-form {
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .registration-form h2 {
            margin-bottom: 20px;
        }
        .registration-form input[type="text"],
        .registration-form input[type="password"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .registration-form input[type="submit"] {
            background-color: #28a745;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .registration-form input[type="submit"]:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>

<div class="registration-form">
    <h2>Registration</h2>
    <form action="/register" method="post">
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <input type="submit" value="Register">
    </form>
</div>

</body>
</html>

register_success:

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login Form</title>
    <style>
        /* 简单的样式来美化表单 */
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        .login-form {
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .login-form h2 {
            margin-bottom: 20px;
        }
        .login-form input[type="text"],
        .login-form input[type="password"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-form input[type="submit"] {
            background-color: #ff0000;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-form input[type="submit"]:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>

<div class="login-form">
    <h2>Login</h2>
    <form action="/login" method="post">
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <input type="submit" value="Login">
    </form>
</div>
</body>
<script>
    alert(' 注册成功,请登录!');

   </script>
</html>

register_failed:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registration Form</title>
    <style>
        /* 简单的样式来美化表单 */
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f0f0f0;
        }
        .registration-form {
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        .registration-form h2 {
            margin-bottom: 20px;
        }
        .registration-form input[type="text"],
        .registration-form input[type="password"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .registration-form input[type="submit"] {
            background-color: #28a745;
            color: white;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .registration-form input[type="submit"]:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>

<div class="registration-form">
    <h2>Registration</h2>
    <form action="/register" method="post">
        <label for="username">Username:</label>
        <input type="text" id="username" name="username" required>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required>

        <input type="submit" value="Register">
    </form>
</div>

</body>
<script>
    alert("注册失败!")
</script>
</html>

第七步:项目启动与测试 

项目启动,参考我的这篇博客:JavaWeb项目启动

运行测试

登录

登录失败

登录成功

注册

注册成功

注册成功会直接跳转到登录页面

注册失败

注册失败,弹出警告框,并且返回注册页面

总结

整体结构图

忽略我没有在博客书写的类和html页面,它们是我自己测试时使用的,不影响整体功能执行

基于三层架构和Servlet进行登录和注册功能的实现项目 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2134360.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

PyQt5 图标(icon)显示问题

遇到这种情况&#xff0c;一般采用下面几种方法&#xff0c;特别是第三种。 第一种&#xff0c;直接应用绝对路径&#xff1a; self.setWindowIcon(QIcon("F:/Workspace/PyQT5-Study/images/cat.png"))第二种&#xff0c;采用动态路径&#xff1a; from PyQt5.QtC…

轻量级模型解读——轻量transformer系列

先占坑&#xff0c;持续更新 。。。 文章目录 1、DeiT2、ConViT3、Mobile-Former4、MobileViT Transformer是2017谷歌提出的一篇论文&#xff0c;最早应用于NLP领域的机器翻译工作&#xff0c;Transformer解读&#xff0c;但随着2020年DETR和ViT的出现(DETR解读&#xff0c;ViT…

YOLOv9改进策略【卷积层】| SCConv:即插即用,减少冗余计算并提升特征学习

一、本文介绍 本文记录的是利用SCConv优化YOLOv9的目标检测网络模型。深度神经网络中存在大量冗余&#xff0c;不仅在密集模型参数中&#xff0c;而且在特征图的空间和通道维度中。SCConv模块通过联合减少卷积层中空间和通道的冗余&#xff0c;有效地限制了特征冗余&#xff0…

领夹麦克风哪个品牌好,哪种领夹麦性价比高,无线麦克风推荐

在音频录制需求日益多样化的今天&#xff0c;无线领夹麦克风作为提升音质的关键设备&#xff0c;其重要性不言而喻。市场上鱼龙混杂&#xff0c;假冒伪劣、以次充好的现象屡见不鲜。这些产品往往以低价吸引消费者&#xff0c;却在音质、稳定性、耐用性等方面大打折扣&#xff0…

突发!OpenAI发布最强模型o1:博士物理92.8分,IOI金牌水平

梦晨 衡宇 发自 凹非寺量子位 | 公众号 QbitAI 参考ChatGPT&#xff1a;点击使用 来了来了&#xff01;刚刚&#xff0c;OpenAI新模型无预警上新&#xff1a; o1系列&#xff0c;可以进行通用复杂推理&#xff0c;每次回答要花费更长时间思考。 在解决博士水平的物理问题时&a…

034-GeoGebra中级篇-关于geogebra的版本以及如何下载本地geogebra

目前&#xff0c;geogebra常用的有geogebra5和geogebra6&#xff0c;本文旨在对比GeoGebra 5和GeoGebra 6两个版本&#xff0c;以揭示它们在功能、用户体验和性能上的主要差异。GeoGebra 5作为一款成熟的数学软件&#xff0c;已经为用户提供了丰富的功能来进行几何、代数、统计…

太牛了!顺丰丰语大语言模型:已应用于20余个场景

9月8日&#xff0c;顺丰科技在深圳国际人工智能展上发布了物流行业的垂直领域大语言模型——丰语&#xff0c;并展示了大模型在顺丰的市场营销、客服、收派、国际关务等业务板块的二十余个场景中的落地实践应用。 发布会现场&#xff0c;中国科学院院士姚建铨、美国医学与生物…

JVS逻辑引擎:如何实现复杂业务逻辑的邮件自动化

大家好&#xff0c;我是软件部长&#xff0c;今天给大家介绍JVS逻辑引擎的发送邮件节点功能。 JVS提供低代码、物联网、规则引擎、智能BI、逻辑引擎、无忧企业文档&#xff08;在线协同&#xff09;、无忧企业计划、无忧企业邮筒等平台&#xff0c;欢迎关注微信公众号: 【软开企…

C# WinForm 中 DataGridView 实现单元格cell 能进编辑状态但是不能修改单元格的效果

在Windows Forms&#xff08;WinForms&#xff09;开发中&#xff0c;DataGridView 控件是一个功能强大的组件&#xff0c; 用于显示和管理表格数据。无论是展示大量数据&#xff0c;还是实现交互式的数据操作&#xff0c; DataGridView 都能提供多样的功能支持&#xff0c;比如…

基于姿态估计的运动打卡健身系统-AI健身教练-3d姿态估计-摔倒检测应用-姿态估计与计数

基于姿态估计的运动系统 引言 随着计算机视觉技术的发展&#xff0c;人体姿态估计&#xff08;Pose Estimation&#xff09;已成为一种广泛应用的技术&#xff0c;特别是在健身、康复训练、体育等领域。姿态估计旨在从图像或视频中检测和定位人体的关键点&#xff0c;如关节位…

【深度学习】【图像分类】【OnnxRuntime】【Python】VggNet模型部署

【深度学习】【图像分类】【OnnxRuntime】【Python】VggNet模型部署 提示:博主取舍了很多大佬的博文并亲测有效,分享笔记邀大家共同学习讨论 文章目录 【深度学习】【图像分类】【OnnxRuntime】【Python】VggNet模型部署前言Windows平台搭建依赖环境模型转换--pytorch转onnxONN…

Understanding the model of openAI 5 (1024 unit LSTM reinforcement learning)

题意&#xff1a;理解 OpenAI 5&#xff08;1024 单元 LSTM 强化学习&#xff09;的模型 问题背景&#xff1a; I recently came across openAI 5. I was curious to see how their model is built and understand it. I read in wikipedia that it "contains a single l…

计算机网络29——Linux基本命令vim,gcc编译命令

1、创建新用户 2、给用户设置密码 3、切换到新用户 切换到root用户 4、删除用户 5、查看ip 6、ping 查看物理上两台主机是否联通 7、netstatus 8、nslookup 查看网址的地址 9、负载均衡与容灾备份 负载均衡&#xff1a;指将负载&#xff08;工作任务&#xff09;进行平衡、分…

为什么mac打不开rar文件 苹果电脑打不开rar压缩文件怎么办

你是否遇到过这样的情况&#xff0c;下载了一个rar文件&#xff0c;想要查看里面的内容&#xff0c;却发现Mac电脑无法打开。rar文件是一种常见的压缩文件格式&#xff0c;它可以将多个文件或文件夹压缩成一个文件&#xff0c;节省空间和传输时间。如此高效实用的压缩文档&…

JavaEE:网络初识

文章目录 网络初识网络中的重要概念IP地址端口号认识协议(最核心概念)OSI七层模型TCP/IP五层(或四层)网络模型网络设备所在分层封装和分用 网络初识 网络中的重要概念 网络互联的目的是进行网络通信,也是网络数据传输,更具体一点,是网络主机中的不同进程间,基于网络传输数据.…

论文解读《LaMP: When Large Language Models Meet Personalization》

引言&#xff1a;因为导师喊我围绕 “大语言模型的个性化、风格化生成” 展开研究&#xff0c;所以我就找相关论文&#xff0c;最后通过 ACL 官网找到这篇&#xff0c;感觉还不错&#xff0c;就开始解读吧&#xff01; “说是解读&#xff0c;其实大部分都是翻译哈哈哈&#x…

域控操作十七点五:域用户无管理员权限下安装IT打包的软件

1&#xff0c;需要软件Runasspcadmin三件套和winrar压缩软件 2&#xff0c;将需要打包的软件放进这个文件夹内&#xff0c;使用播放器举个例子 3&#xff0c;打开runasspcadmin.exe 按图片写就行了 文件夹现在是这样的然后全选右击&#xff0c;用WinRAR添加到压缩包 这个可以自…

量化交易backtrader实践(一)_数据获取篇(4)_通达信数据应用

在第2节实践了从金融数据接口包例如tushare.pro或akshare获取数据&#xff0c;在第3节实践了直接从网页上爬取股票数据。其实&#xff0c;我们的电脑上怎么可能没有几个股票软件&#xff0c;在这些股票软件里&#xff0c;历史行情&#xff0c;实时行情都有&#xff0c;我们能否…

Windows环境本地部署Oracle 19c及卸载实操手册

前言: 一直在做其他测试,貌似都忘了Windows环境oracle 19c的部署,这是一个很早很早的安装记录了,放上来做个备录给到大家参考。 Oracle 19c‌:进一步增强了自动化功能,并提供了更好的性能和安全性。这个版本在自动化、性能和安全性方面进行了重大改进,以满足现代企业对数…

运维人员转行 AI 大模型全攻略:史上最详尽总结,一篇在手,转行无忧!

前言 做运维的苦&#xff0c;谁做谁懂。有时候真感觉自己就像个杂役&#xff0c;在公司都快成修电脑的了。不装了&#xff0c;我要转行&#xff01;在此给大家分享点经验&#xff0c;希望能帮到你们。 运维工程师若要转行至大模型领域&#xff0c;需要学习一系列全新的技能与…