欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

spring boot+thymeleaf+bootstrap實(shí)現(xiàn)后臺(tái)管理系統(tǒng)界面

 更新時(shí)間:2020年04月08日 09:32:37   作者:Vitmin  
這篇文章主要為大家詳細(xì)介紹了spring boot+thymeleaf+bootstrap簡(jiǎn)單實(shí)現(xiàn)后臺(tái)管理系統(tǒng)界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

最近在學(xué)spring boot ,學(xué)習(xí)一個(gè)框架無(wú)非也就是使用它來(lái)做以前做的事情,兩者比較才有不同,說(shuō)一下自己使用的體會(huì)。
先來(lái)說(shuō)下spring boot ,微框架??焖匍_(kāi)發(fā),相當(dāng)于零配置,從一個(gè)大神那看來(lái)的說(shuō):spring boot 相當(dāng)于框架的框架 ,就是集成了很多,用哪個(gè)添加哪個(gè)的依賴就行,這樣的話自己看不到配置,對(duì)于習(xí)慣了使用配置剛使用spring boot的開(kāi)發(fā)者來(lái)說(shuō)可能還有點(diǎn)不習(xí)慣,什么都不用配,看不到配置感覺(jué)對(duì)項(xiàng)目整體架構(gòu)有點(diǎn)陌生,再說(shuō)在spring boot 中使用 thymeleaf 。就拿個(gè)最簡(jiǎn)單的例子來(lái)說(shuō)明 jsp顯示helloworld , thymeleaf顯示helloworld,兩者也就pom文件引入依賴和屬性文件配置不同,在你使用jsp的時(shí)候不要引入thymeleaf的依賴,當(dāng)然在使用thymeleaf的時(shí)候也不要引入jsp的依賴 有可能會(huì)產(chǎn)生沖突,spring boot 官方是推薦使用thymeleaf 我個(gè)人感覺(jué)也不錯(cuò),開(kāi)始項(xiàng)目吧!

1 、首先 建一個(gè)meaven項(xiàng)目 看一下建好的項(xiàng)目整體結(jié)構(gòu)

建好項(xiàng)目結(jié)構(gòu)弄pom.xml ,這個(gè)demo只用到thymeleaf,沒(méi)有數(shù)據(jù)庫(kù)方面的依賴,所需依賴很少

<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/xsd/maven-4.0.0.xsd"> 
 <modelVersion>4.0.0</modelVersion> 
 <groupId>Springboot_bootstrap</groupId> 
 <artifactId>Springboot_bootstrap</artifactId> 
 <version>0.0.1-SNAPSHOT</version> 
 <parent> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-parent</artifactId> 
 <version>1.4.7.RELEASE</version> 
 <relativePath/> <!-- lookup parent from repository --> 
 </parent> 
 
 <properties> 
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
 <java.version>1.8</java.version> 
 </properties> 
 
 <dependencies> 
 <dependency> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter</artifactId> 
 </dependency> 
 
 <dependency> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-web</artifactId> 
 </dependency> 
 
 <!-- thymeleaf --> 
 
 <dependency> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-starter-thymeleaf</artifactId> 
 </dependency> 
 
 </dependencies> 
 
 <build> 
 <plugins> 
 <plugin> 
 <groupId>org.springframework.boot</groupId> 
 <artifactId>spring-boot-maven-plugin</artifactId> 
 </plugin> 
 </plugins> 
 </build> 
</project> 

在src /main/resource 建立 application.properties文件

server.port=8080 
server.session.timeout=10 
server.tomcat.uri-encoding=UTF-8 
 
spring.thymeleaf.prefix=classpath:/views/ 
spring.thymeleaf.suffix=.html 
spring.thymeleaf.mode=HTML5 
spring.thymeleaf.encoding=UTF-8 
spring.thymeleaf.content-type=text/html 
spring.thymeleaf.cache=false 

寫入口程序

package com.zanghan.youyu; 
 
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication; 
 
@SpringBootApplication 
public class YouYuApplication { 
 
 public static void main(String[] args) { 
 SpringApplication.run(YouYuApplication.class, args); 
 } 
} 

控制器跳轉(zhuǎn)bootstrap界面

package com.zanghan.youyu.controller; 
 
import org.springframework.stereotype.Controller; 
import org.springframework.web.bind.annotation.RequestMapping; 
 
@Controller 
public class LoginController { 
 @RequestMapping("/") 
 public String index(){ 
 return "/index"; 
 } 
} 

引入bootstrap js css 放在哪里?放在static文件夾里,views中放的是頁(yè)面

index.html界面存放在 src/main/resource 下的views 文件夾里,為啥不是tepmlates 因?yàn)樵趯傩耘渲梦募袑懙氖莢iews ,thymeleaf 的前綴和后綴都可以改變的

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" 
 xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"> 
<head> 
 <meta charset="utf-8" /> 
 <meta http-equiv="X-UA-Compatible" content="IE=edge"/> 
 <meta name="viewport" content="width=device-width, initial-scale=1"/> 
 <title>MES平臺(tái)</title> 
 <!--Bootstrap--> 
 <link th:href="@{Bootstrap/bootstrap/css/bootstrap.min.css}" rel="stylesheet" /> 
 <!-- Font Awesome --> 
 <link th:href="@{Bootstrap/font-awesome/css/font-awesome.min.css}" rel="stylesheet" /> 
 <!--[if IE 7]> 
 <link href="/Content/font-awesome/css/font-awesome-ie7.min.css" rel="stylesheet" /> 
 <![endif]--> 
 <link th:href="@{Bootstrap/sidebar-menu/sidebar-menu.css}" rel="stylesheet" /> 
 <link th:href="@{Bootstrap/ace/css/ace-rtl.min.css}" rel="stylesheet" /> 
 <link th:href="@{Bootstrap/ace/css/ace-skins.min.css}" rel="stylesheet" /> 
 <link th:href="@{Bootstrap/toastr/toastr.min.css}" rel="stylesheet" /> 
 
 <script th:src="@{Bootstrap/jquery-1.9.1.min.js}"></script> 
 <script th:src="@{Bootstrap/bootstrap/js/bootstrap.min.js}"></script> 
 <script th:src="@{Bootstrap/sidebar-menu/sidebar-menu.js}"></script> 
 <script th:src="@{Bootstrap/bootstrap/js/bootstrap-tab.js}"></script> 
 <!--[if lt IE 9]> 
 <script src="/Scripts/html5shiv.js"></script> 
 <script src="/Scripts/respond.min.js"></script> 
 <![endif]--> 
 <style type="text/css"> 
 body { 
 font-size: 12px; 
 } 
 
 .nav > li > a { 
 padding: 5px 10px; 
 } 
 
 .tab-content { 
 padding-top: 3px; 
 } 
 </style> 
</head> 
<body> 
 <div class="navbar navbar-default" id="navbar"> 
 
 <ul class="navbar-header pull-left"> 
  
  <a class="fa fa-list-ul menu-toggler" id="menu-toggler" href="#"> 
  <i class="icon-reorder" style="font-size:20px;margin-left:-18px;margin-top:8px;display:flex;"></i> 
  </a> 
  
 <a href="#" class="navbar-brand"> 
  <small> 
  
  Primaopto 
  </small> 
 </a> 
 </ul> 
 <div class="navbar-header pull-right" role="navigation"> 
 <ul class="nav ace-nav"> 
 
 <li class="light-blue" style="height:50px;"> 
  
  <a data-toggle="dropdown" href="#" class="dropdown-toggle"> 
  <img class="nav-user-photo" src="Content/ace/avatars/avatar2.png" alt="Admin's Photo" /> 
  <span class="user-info"> 
  <small>歡迎光臨,</small> 
  1310177 
  </span> 
 
  <i class="icon-caret-down"></i> 
  </a> 
  <ul class="user-menu pull-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close"> 
  <li> 
  <a href="#"> 
  <i class="icon-cog"></i> 
  設(shè)置 
  </a> 
  </li> 
  <li> 
  <a href="#"> 
  <i class="icon-user"></i> 
  個(gè)人資料 
  </a> 
  </li> 
  <li class="divider"></li> 
  <li> 
  <a href="/Home/Logout"> 
  <i class="icon-off"></i> 
  退出 
  </a> 
  </li> 
  </ul> 
 </li> 
 </ul> 
 </div> 
 </div> 
 
 <div class="main-container" id="main-container"> 
 <div class="main-container-inner"> 
 
 <div class="sidebar" id="sidebar"> 
  <div class="sidebar-collapse" id="sidebar-collapse" style="display:none;"> 
  <i class="icon-double-angle-left" data-icon1="icon-double-angle-left" data-icon2="icon-double-angle-right"></i> 
 </div> 
 <ul class="nav nav-list" id="menu"></ul> 
 
 </div> 
 <div class="main-content"> 
 <div class="page-content"> 
  <div class="row"> 
  <div class="col-xs-12" style="padding-left:5px;"> 
  <ul class="nav nav-tabs" role="tablist"> 
  <li class="active"><a href="#Index" role="tab" data-toggle="tab">系統(tǒng)首頁(yè)</a></li> 
  </ul> 
  <div class="tab-content" style="height:1000px"> 
  <div role="tabpanel" class="tab-pane active" id="Index" style="height:100%"> 
  <h2>歡迎進(jìn)入后臺(tái)管理系統(tǒng)</h2> 
  </div> 
  </div> 
  </div> 
  </div> 
 </div> 
 </div> 
 
 </div> 
 
 </div> 
 <script type="text/javascript"> 
 //toastr.options.positionClass = 'toast-bottom-right'; 
 $(function () { 
 $('#menu').sidebarMenu({ 
 data: [{ 
  id: '1', 
  text: '系統(tǒng)設(shè)置', 
  icon: 'icon-cog', 
  url: '', 
  menus: [{ 
  id: '2', 
  text: '編碼管理1', 
  icon: 'icon-glass', 
  url: '', 
  menus: [{ 
  id: '3', 
  text: '編碼管理2', 
  icon: 'icon-glass', 
  url: '', 
  menus: [{ 
  id: '2', 
  text: '編碼管理1', 
  icon: 'icon-glass', 
  url: '', 
  
  }, 
  { 
  id: '3', 
  text: '編碼管理2', 
  icon: 'icon-glass', 
  url: '', 
  
  },{ 
  id: '4', 
  text: '編碼管理3', 
  icon: 'icon-glass', 
  url: '', 
  
  }] 
  }] 
  }] 
  
  
 }] 
 }); 
 
 $("#menu-toggler").click(function () { 
 var children = $("#sidebar-collapse").children("i"); 
 if ($(children).hasClass("icon-double-angle-left")) { 
  $(children).removeClass("icon-double-angle-left").addClass("icon-double-angle-right"); 
  $("#sidebar").attr("class", "sidebar menu-min display"); 
 } 
 else { 
  $(children).removeClass("icon-double-angle-right").addClass("icon-double-angle-left"); 
  $("#sidebar").attr("class", "sidebar display"); 
 } 
 }); 
 }); 
 </script> 
 <script th:src="@{Bootstrap/ace/js/ace-extra.min.js}"></script> 
 <script th:src="@{Bootstrap/ace/js/ace.min.js}"></script> 
</body> 
</html> 

搞定,運(yùn)行application 輸入localhost:8080

更多學(xué)習(xí)資料請(qǐng)關(guān)注專題《管理系統(tǒng)開(kāi)發(fā)》。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • java集合與數(shù)組的相同點(diǎn)和不同點(diǎn)

    java集合與數(shù)組的相同點(diǎn)和不同點(diǎn)

    今天小編就為大家分享一篇關(guān)于java集合與數(shù)組的相同點(diǎn)和不同點(diǎn),小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-04-04
  • MyBatis中的模糊查詢語(yǔ)句

    MyBatis中的模糊查詢語(yǔ)句

    這篇文章主要介紹了MyBatis中的模糊查詢語(yǔ)句的相關(guān)資料,需要的朋友可以參考下
    2017-03-03
  • Java中SPI機(jī)制的實(shí)現(xiàn)詳解

    Java中SPI機(jī)制的實(shí)現(xiàn)詳解

    SPI(Service?Provider?Interface),是?JDK?內(nèi)置的一種服務(wù)提供發(fā)現(xiàn)機(jī)制,可以用來(lái)啟用框架擴(kuò)展和替換組件,下面我們就來(lái)看看Java中SPI機(jī)制的具體實(shí)現(xiàn)
    2024-01-01
  • Java反射之類的實(shí)例對(duì)象的三種表示方式總結(jié)

    Java反射之類的實(shí)例對(duì)象的三種表示方式總結(jié)

    下面小編就為大家?guī)?lái)一篇Java反射之類的實(shí)例對(duì)象的三種表示方式總結(jié)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-10-10
  • Jmeter參數(shù)化實(shí)現(xiàn)原理及過(guò)程解析

    Jmeter參數(shù)化實(shí)現(xiàn)原理及過(guò)程解析

    這篇文章主要介紹了Jmeter參數(shù)化實(shí)現(xiàn)原理及過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Spring定時(shí)任務(wù)注解@Scheduled詳解

    Spring定時(shí)任務(wù)注解@Scheduled詳解

    這篇文章主要介紹了Spring定時(shí)任務(wù)注解@Scheduled詳解,@Scheduled注解是包org.springframework.scheduling.annotation中的一個(gè)注解,主要是用來(lái)開(kāi)啟定時(shí)任務(wù),本文提供了部分實(shí)現(xiàn)代碼與思路,需要的朋友可以參考下
    2023-09-09
  • 基于MockMvc進(jìn)行springboot調(diào)試(SpringbootTest)

    基于MockMvc進(jìn)行springboot調(diào)試(SpringbootTest)

    這篇文章主要介紹了基于MockMvc進(jìn)行springboot調(diào)試(SpringbootTest),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-10-10
  • Spring服務(wù)注解有哪些

    Spring服務(wù)注解有哪些

    這篇文章主要介紹了Spring服務(wù)注解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2016-11-11
  • SpringBoot深入分析webmvc和webflux的區(qū)別

    SpringBoot深入分析webmvc和webflux的區(qū)別

    這篇文章主要介紹了SpringBoot深入分析webmvc和webflux的區(qū)別,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧
    2023-02-02
  • Gson中@JsonAdater注解的幾種方式總結(jié)

    Gson中@JsonAdater注解的幾種方式總結(jié)

    這篇文章主要介紹了Gson中@JsonAdater注解的幾種方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-08-08

最新評(píng)論