SpringBoot學習筆記四之后台登錄頁面的實現


注:圖片如果損壞,點擊文章鏈接:

https://www.toutiao.com/i6803542216150090252/

繼續之前完成的內容,首先創建一個常量類

SpringBoot學習筆記四之后台登錄頁面的實現

 

常量類的內容

SpringBoot學習筆記四之后台登錄頁面的實現

 

服務器端渲染

SpringBoot學習筆記四之后台登錄頁面的實現

 

前后端分離

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成后台管理登錄頁面

進入前端靜態資源

SpringBoot學習筆記四之后台登錄頁面的實現

 

創建后台管理員登錄頁面admin-login.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成內容

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

然后完成頁面跳轉

配置mvc:view-controller

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成配置

SpringBoot學習筆記四之后台登錄頁面的實現

 

啟動服務訪問一下

localhost:8080/learn-admin-webui/admin/to/login/page.html
SpringBoot學習筆記四之后台登錄頁面的實現

 

修飾system-error.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

Md5加密工具方法

添加到類

SpringBoot學習筆記四之后台登錄頁面的實現

 

編寫代碼

SpringBoot學習筆記四之后台登錄頁面的實現

 

接着

SpringBoot學習筆記四之后台登錄頁面的實現

 

測試下

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

自定義異常

創建異常類

SpringBoot學習筆記四之后台登錄頁面的實現

 

登錄失敗后拋出的異常

SpringBoot學習筆記四之后台登錄頁面的實現

 

用戶沒有登錄就訪問受保護資源時拋出的異常

SpringBoot學習筆記四之后台登錄頁面的實現

 

在異常處理器中增加登錄失敗的異常

SpringBoot學習筆記四之后台登錄頁面的實現

 

頁面顯示錯誤的地方

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成AdminHandler

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成登錄方法

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成adminService.getAdminByLoginAcct

SpringBoot學習筆記四之后台登錄頁面的實現

 

選擇方法ctrl+1

SpringBoot學習筆記四之后台登錄頁面的實現

 

會自動在接口中寫好,補好注釋

SpringBoot學習筆記四之后台登錄頁面的實現

 

在按ctrl+t,彈出菜單

SpringBoot學習筆記四之后台登錄頁面的實現

 

進入實現類后,按ctrl+!加入未實現的方法

SpringBoot學習筆記四之后台登錄頁面的實現

 

按ctrl+o(字母),定位到我們使用的方法

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成方法體

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

重定向到主頁面

redirect:/admin/to/main/page.html
SpringBoot學習筆記四之后台登錄頁面的實現

 

創建admin-main.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

編寫內容

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

在spring-web-mvc.xml中完成mvc:view-controller

SpringBoot學習筆記四之后台登錄頁面的實現

 

其中這三個頁面我們完成以下

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

頁面代碼

Include-head.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

Include-nav.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

Include-sidebar.jsp

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

退出登錄

SpringBoot學習筆記四之后台登錄頁面的實現

 

頁面對應的點擊位置

SpringBoot學習筆記四之后台登錄頁面的實現

 

登錄檢查

SpringBoot學習筆記四之后台登錄頁面的實現

 

創建攔截器類

SpringBoot學習筆記四之后台登錄頁面的實現

 

完成代碼

SpringBoot學習筆記四之后台登錄頁面的實現

 

注冊攔截器,配置文件spring-web-mvc.xml

SpringBoot學習筆記四之后台登錄頁面的實現

 

測試下

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現

 

SpringBoot學習筆記四之后台登錄頁面的實現


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM