springboot集成shiro前的工作

由于要跳轉(zhuǎn)頁面,我這里使用thymleaf模板

引入了Spirng Boot對thymleaf模板引擎的依賴。版本(Mar 03, 2017)

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-thymeleaf</artifactId>
    <version>1.5.2.RELEASE</version>
</dependency>

寫幾個簡單的頁面,用thymleaf模板的一些配置在我簡書的一篇文章也有寫到http://www.itdecent.cn/p/381e02c283f3
index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Insert title here</title>
</head>
<body>
<h1>index</h1>
</body>
</html>

login.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Insert title here</title>
</head>
<body>
錯誤信息:<h4 th:text="${msg}"></h4>
<form action="" method="post">
    <p>賬號:<input type="text" name="username" value="admin"/></p>
    <p>密碼:<input type="text" name="password" value="123456"/></p>
    <p><input type="submit" value="登錄"/></p>
</form>
</body>
</html>

寫完之后是訪問不了login頁面的,是因為還沒寫Controller,不能寫成@RestController,因為不是返回json數(shù)據(jù),而是跳轉(zhuǎn)頁面

@Controller
public class HomeController {
    @RequestMapping({"/","/index"})
    public String index(){
        return"/index";
    }

    @GetMapping("login")
    public String login(){
        return"login";
    }
}

接下來再創(chuàng)建兩個頁面,userInfo和userInfoAdd
userInfo

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Title</title>
</head>
<body>
<h3>用戶查詢界面</h3>
</body>
</html>

userInfoAdd

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Insert title here</title>
</head>
<body>
<h3>用戶添加界面</h3>
</body>
</html>

userInfoDel

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Insert title here</title>
</head>
<body>
<h3>用戶刪除界面</h3>
</body>
</html>

當然了,后面這是要一定權限才可以登錄進去的,那怎么做了,接下來再講

文章主要參考于作者林祥纖的博客

http://412887952-qq-com.iteye.com/blog/2299732

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,569評論 19 139
  • 在此特此聲明:一下所有鏈接均來自互聯(lián)網(wǎng),在此記錄下我的查閱學習歷程,感謝各位原創(chuàng)作者的無私奉獻 ! 技術一點一點積...
    遠航的移動開發(fā)歷程閱讀 11,544評論 12 197
  • 一、Monobehaviour類 Unity中的腳本都是繼承Monobehaviour,定義了腳本的基本行為。必然...
    _涼笙閱讀 7,656評論 0 2
  • 這期醉讀推薦的書名為《茶葉的流動——閩北山區(qū)的物質(zhì)、空間與歷史敘事(1644-1949)》,著者是人類學博士肖坤冰...
    酒公子閱讀 848評論 0 0

友情鏈接更多精彩內(nèi)容