zoukankan      html  css  js  c++  java
  • SpringBoot实现登陆

    1、依赖

    <?xml version="1.0" encoding="UTF-8"?>
    <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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.2.1.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.zn</groupId>
        <artifactId>springboot_invoicing</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>springboot_invoicing</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </dependency>
            <!-- 核心依赖 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!-- 可以实现热部署,在IDEA上实现热部署还需一些额外的配置,请查阅资料 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <optional>true</optional>
                <scope>runtime</scope>
            </dependency>
    
            <!-- JDBC for mysql -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.32</version>
            </dependency>
    
            <!-- mybatis -->
            <!--mybatis-->
            <!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.3.1</version>
            </dependency>
    
            <!--fastJson-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.2.12</version>
            </dependency>
            <!--druid-->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>1.0.18</version>
            </dependency>
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis</artifactId>
                <version>3.4.1</version>
            </dependency>
            <!--thymeleaf  新的模板引擎,比jsp要出色-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
            <!--jdbc-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
    
            <!-- 分页插件 -->
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>1.2.3</version>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
            <!--xml配置,此是为了将来整合Hibernate或者mybatis 默认没有需要配置-->
            <resources>
                <resource>
                    <directory>src/main/java</directory>
                    <includes>
                        <include>**/*.properties</include>
                        <include>**/*.xml</include>
                    </includes>
                </resource>
            </resources>
        </build>
    
    </project>
    View Code

    2、配置application.properties

        

    3、登陆页面 login.html

    <!DOCTYPE html>
    <html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>系统登录 - 小型进销存系统</title>
       <!-- <link rel="stylesheet" href="css/style.css"/>-->
        <style>
            #parent{
                width:500px;
                height:200px;
                margin-top:20%;
                margin-left:50%;
                transform:translate(-50%,-50%) ;
                background:#009688;
            }
            .password,.subBtn{
                margin-top: 2%;
                margin-left: 3%;
            }
            .loginHeader{
                padding-top: 1%;
            }
        </style>
    </head>
    <body class="login_bg">
    <div id="parent">
        <section class="loginBox">
            <header class="loginHeader" style="text-align:center; ">
                <h1>小型进销存系统</h1>
            </header>
            <section class="loginCont">
                <form class="loginForm" action="/user/login" method="post" onsubmit="return check()" >
                    <div class="inputbox"  style="text-align:center; ">
                        <label for="user">用户名:</label>
                        <input id="user" type="text" name="userName" placeholder="请输入用户名" required="required" />
                    </div>
                    <div class="password"  style="text-align:center; " >
                        <label for="mima">密码:</label>
                        <input id="mima" type="password" name="password" placeholder="请输入密码" required="required" />
                    </div>
                    <div class="subBtn"  style="text-align:center; ">
                        <input type="submit" value="登录" />
                        <input type="reset" value="重置"/>
                    </div>
                </form>
            </section>
        </section>
    </div>
    </body>
    </html>
    View Code

    4、实体类

        

    5、dao层UserDao

        

    6、UserDao.xml

        

     7、UserService

        

     8、UserServiceImpl

        

     9、controller

        

     10、SpringbootInvoicingApplication

        

  • 相关阅读:
    Golang之字符串格式化
    BZOJ 4513: [Sdoi2016]储能表 [数位DP !]
    BZOJ 3329: Xorequ [数位DP 矩阵乘法]
    BZOJ 1833: [ZJOI2010]count 数字计数 [数位DP]
    HDU2089 不要62 BZOJ1026: [SCOI2009]windy数 [数位DP]
    未完
    [Miller-Rabin & Pollard-rho]【学习笔记】
    BZOJ 3551: [ONTAK2010]Peaks加强版 [Kruskal重构树 dfs序 主席树]
    BZOJ 3123: [Sdoi2013]森林 [主席树启发式合并]
    BZOJ 3545: [ONTAK2010]Peaks [Splay启发式合并]
  • 原文地址:https://www.cnblogs.com/Zzzzn/p/11989094.html
Copyright © 2011-2022 走看看