zoukankan      html  css  js  c++  java
  • SpringBoot简单项目学习笔记01(项目跟路径设定、项目首址设定)

    github项目地址:https://github.com/H-Designer/SpringBoot

    初学SpringBoot,记录一下自己的学习过程,同时也进行简单项目的总结(这里全是对这个项目进行的个人总结),或许可以说是这个程序的业务逻辑的梳理

    这个项目就是一个简单的增删改的员工个人信息系统(前端使用的是thymeleaf),(这里不涉及SpringBoot的最基本的框架的讲解,是SpringBoot的项目实例)

    下面就是个人对这个项目的总结,不当之处还请大佬们指出

    这一节总结项目的最开始的设定(项目跟路径设定、项目首址设定)

    
    
    ##1.首先会根据application.properties进行网页访问的根路径(/crud)
    
    //http://localhost:8080/crud
    ##2.根据在controller中设置的首址映射,访问固定的地址进行访问程序(访问到的是login页面)
    @Controller
    public class IndexController {
    // 这是通过控制请求,在地址栏中没有请求的时候,也跳到我们想要的页面,而不是通过springboot的首址映射直接跳到index页面
    @RequestMapping({"/","index.html"})
    public String index(){
    return "login";
    }
    }
    ##3.根据在controller中设置的首址映射,访问固定的地址进行访问程序(访问到的是login页面)
    <!DOCTYPE html>
    <html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Signin Template for Bootstrap</title>
    <!-- Bootstrap core CSS -->
    <link th:href="@{asserts/css/bootstrap.min.css}" rel="stylesheet">
    <!--<link href="asserts/css/bootstrap.min.css" rel="stylesheet">-->
    <!-- Custom styles for this template -->
    <!--<link href="asserts/css/signin.css" rel="stylesheet">-->
    <link th:href="@{asserts/css/signin.css}" rel="stylesheet">
    </head>
    <body class="text-center">
    <form class="form-signin" th:action="@{/user/login}" action="dashboard.html" th:method="post">
    <img class="mb-4" th:src="@{asserts/img/bootstrap-solid.svg}" alt="" width="72" height="72">
    <h1 class="h3 mb-3 font-weight-normal" th:text="#{login.tip}"></h1>
    <!--判断是否提示信息-->
    <p th:text="${mes}" style="color: red" th:if="${not #strings.isEmpty(mes)}"/>
    <label class="sr-only"th:text="#{login.username}"></label>
    <input type="text" name="username" class="form-control" th:placeholder="#{login.username}" required="" autofocus="">
    <label class="sr-only"th:text="#{login.password}"></label>
    <input type="password" name="password" class="form-control" th:placeholder="#{login.password}" required="">
    <div class="checkbox mb-3">
    <label>
    <input type="checkbox" value="remember-me"> [[#{login.remember}]]
    </label>
    </div>
    <button class="btn btn-lg btn-primary btn-block" type="submit" th:text="#{login.btn}"></button>
    <p class="mt-5 mb-3 text-muted">© 2017-2018</p>
    <a class="btn btn-sm" th:href="@{/index.html(l='zh_CN')}">中文</a>
    <a class="btn btn-sm" th:href="@{/index.html(l='en_US')}">English</a>
    </form>
    </body>
    </html>

    下一节总结项目的国际化语言设定,以及拦截器的设定:地址https://www.cnblogs.com/zhaochunhui/p/11331976.html

  • 相关阅读:
    Python的未来发展方向
    loadrunner分析之网页、网络、资源分析
    Django框架Day2之Template
    Django框架Day3之Models
    Appium 常用的API函数
    Django框架Day1之url和views
    Loadrunner常用分析点
    WEB性能测试用例设计
    python之高阶函数map()和reduce()
    python csv文件打开错误:_csv.Error: line contains NULL byte
  • 原文地址:https://www.cnblogs.com/zhaochunhui/p/11331803.html
Copyright © 2011-2022 走看看