Compare commits
1 Commits
s-sakiyama
...
f5b6fcdc40
| Author | SHA1 | Date | |
|---|---|---|---|
| f5b6fcdc40 |
@@ -1,19 +1,9 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import jakarta.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import com.example.demo.form.ApprovalForm;
|
||||
|
||||
/**
|
||||
* 書籍貸出承認確認用のコントローラ
|
||||
*/
|
||||
@@ -21,44 +11,46 @@ import com.example.demo.form.ApprovalForm;
|
||||
public class ApprovalConfirmController {
|
||||
|
||||
// ログ出力用インスタンス
|
||||
private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
|
||||
// private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
|
||||
|
||||
// エラーメッセージ用の定数フィールド
|
||||
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||
// private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||
|
||||
HttpSession httpSession;
|
||||
Request request;
|
||||
// HttpSession httpSession;
|
||||
// Request request;
|
||||
//
|
||||
// @Autowired
|
||||
// public ApprovalConfirmController(
|
||||
// HttpSession httpSession,
|
||||
// Request request) {
|
||||
// this.httpSession = httpSession;
|
||||
// this.request = request;
|
||||
// }
|
||||
//
|
||||
// @ModelAttribute
|
||||
// public ApprovalForm approvalForm() {
|
||||
// return new ApprovalForm();
|
||||
// }
|
||||
|
||||
@Autowired
|
||||
public ApprovalConfirmController(
|
||||
HttpSession httpSession,
|
||||
Request request) {
|
||||
this.httpSession = httpSession;
|
||||
this.request = request;
|
||||
}
|
||||
@RequestMapping(value = "/approvalConfirm", method = RequestMethod.POST)
|
||||
public String AprrvalForm() {
|
||||
|
||||
@ModelAttribute
|
||||
public ApprovalForm approvalForm() {
|
||||
return new ApprovalForm();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/ApprovalConfirm", method = RequestMethod.POST)
|
||||
public String AprrvalForm(ApprovalForm ApprovalForm, Model model) {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
return a ;
|
||||
} catch (Exception e) {
|
||||
// ログイン情報の破棄
|
||||
httpSession.invalidate();
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
// エラーログ出力
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||
// エラー画面遷移
|
||||
return "error";
|
||||
}
|
||||
System.out.println("a");
|
||||
return "bookList";
|
||||
// try {
|
||||
//
|
||||
//
|
||||
// return ;
|
||||
// } catch (Exception e) {
|
||||
// // ログイン情報の破棄
|
||||
// httpSession.invalidate();
|
||||
//
|
||||
// e.printStackTrace();
|
||||
//
|
||||
// // エラーログ出力
|
||||
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||
// // エラー画面遷移
|
||||
// return "error";
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.example.demo.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
||||
/**
|
||||
* 書籍貸出完了・却下処理用のコントローラ
|
||||
*/
|
||||
@Controller
|
||||
public class ApprovalConfirmResultController {
|
||||
|
||||
}
|
||||
@@ -1,15 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||
<!-- 外部のスクリプトファイルを読み込む -->
|
||||
<script th:src="@{/js/common.js}"></script>
|
||||
<!-- CSSの読み込み -->
|
||||
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||
<title>書籍貸出承認確認</title>
|
||||
<title>書籍貸出承認完了画面</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<h2>書籍貸出申請を承認しました。</h2>
|
||||
<br/>
|
||||
<a href="javascript:insertSubmit()">承認待ち一覧に戻る</a> | <a href="showMenu">メニューに戻る</a>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
function insertSubmit() {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('action', 'approvalConfirm');
|
||||
|
||||
// 動的送信用のHidden
|
||||
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||
const inputField = document.createElement("input");
|
||||
inputField.setAttribute("type", "hidden");
|
||||
inputField.setAttribute("value", "select");
|
||||
|
||||
form.appendChild(inputField);
|
||||
|
||||
// フォームをDOMに追加
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
@@ -18,10 +18,8 @@
|
||||
</h1>
|
||||
<!-- 変数名は変更したが、中身は変更していない -->
|
||||
<!-- ボタンや遷移も手を付けていない -->
|
||||
<form action="insertEmployee"
|
||||
id="insertForm"
|
||||
method="post"
|
||||
th:object="${insertEmployeeForm}">
|
||||
<form action="approvalConfirm"
|
||||
method="post">
|
||||
|
||||
<div class="msgBox error" th:if="${messageError != null}">
|
||||
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span>
|
||||
@@ -135,7 +133,20 @@
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="btnArea" colspan="2">
|
||||
<input type="submit" value="承認"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="btnArea" colspan="2">
|
||||
<input type="submit" value="却下"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
<a href="javascript:insertSubmit()">承認待ち一覧に戻る</a>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +1,40 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head>
|
||||
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
||||
<!-- 外部のスクリプトファイルを読み込む -->
|
||||
<script th:src="@{/js/common.js}"></script>
|
||||
<!-- CSSの読み込み -->
|
||||
<link rel="stylesheet" th:href="@{/css/all.css}">
|
||||
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
|
||||
<title>書籍貸出承認確認</title>
|
||||
<title>書籍貸出却下画面</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<body>
|
||||
<h2>書籍貸出申請を却下しました。</h2>
|
||||
<br/>
|
||||
<a href="javascript:insertSubmit()">承認待ち一覧に戻る</a> | <a href="showMenu">メニューに戻る</a>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
function insertSubmit() {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('action', 'approvalConfirm');
|
||||
|
||||
// 動的送信用のHidden
|
||||
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||
const inputField = document.createElement("input");
|
||||
inputField.setAttribute("type", "hidden");
|
||||
inputField.setAttribute("value", "select");
|
||||
|
||||
form.appendChild(inputField);
|
||||
|
||||
// フォームをDOMに追加
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user