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學習筆記四之後臺登錄頁面的實現

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章