[ADD]エラー画面処理を実装しました
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
package com.example.demo.app.presentation.controller;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ErrorController {
|
||||||
|
@GetMapping("/error")
|
||||||
|
public String showError() {
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
32
src/main/resources/templates/error.html
Normal file
32
src/main/resources/templates/error.html
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>エラー</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center mt-5">
|
||||||
|
|
||||||
|
<h2 class="text-danger">
|
||||||
|
エラーが発生しました
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<p th:text="${errorMessage}"></p>
|
||||||
|
|
||||||
|
<a class="btn btn-primary" th:href="@{/login}">
|
||||||
|
ログイン画面へ
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user