3段階目終了
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.example.rhizome.app.domain.service;
|
||||
|
||||
import com.example.rhizome.app.domain.model.Department;
|
||||
|
||||
public interface UpdateDepartment {
|
||||
void updateDepartment(Department beforeDepartment, Department updateDepertment);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.example.rhizome.app.domain.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.example.rhizome.app.domain.model.Department;
|
||||
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
||||
import com.example.rhizome.app.infra.entity.DepartmentEntity;
|
||||
import com.example.rhizome.app.infra.repository.DepartmentRepository;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class UpdateDepartmentImpl implements UpdateDepartment {
|
||||
|
||||
DepartmentRepository departmentRepository;
|
||||
|
||||
@Autowired
|
||||
public UpdateDepartmentImpl(DepartmentRepository departmentRepository) {
|
||||
this.departmentRepository = departmentRepository;
|
||||
}
|
||||
|
||||
public void updateDepartment(Department beforeDepartment, Department updateDepertment) {
|
||||
departmentRepository.save(DepartmentEntity.convertFrom(mergeDepartment(beforeDepartment,updateDepertment)));
|
||||
|
||||
}
|
||||
|
||||
private Department mergeDepartment(Department beforeDepartment, Department updateDepartment) {
|
||||
return new Department(updateDepartment.getIdDepartment(),updateDepartment.getNmDepartment());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +1,82 @@
|
||||
//package com.example.rhizome.app.presentation.controller;
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.logging.Logger;
|
||||
//
|
||||
//import javax.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 org.springframework.web.bind.annotation.RequestParam;
|
||||
//
|
||||
//import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
//import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
//import com.example.rhizome.app.domain.model.Department;
|
||||
//import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||
//import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||
//import com.example.rhizome.app.domain.service.SearchDepartmentInfo;
|
||||
//import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
//import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
//import com.example.rhizome.app.presentation.form.DepartmentForm;
|
||||
//import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
//import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||
//import com.example.rhizome.app.presentation.form.UpdateEmployeeInfoForm;
|
||||
//
|
||||
//@Controller
|
||||
//public class UpdateDepartmentController {
|
||||
//
|
||||
// // ログ出力用インスタンス
|
||||
// private final static Logger LOGGER = Logger.getLogger(UpdateDepartmentController.class.getName());
|
||||
// // エラーメッセージ用の定数フィールド
|
||||
// private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||
//
|
||||
// HttpSession httpSession;
|
||||
// SearchDepartment searchDepartment;
|
||||
//
|
||||
// @Autowired
|
||||
// public UpdateDepartmentController(HttpSession httpSession, SearchDepartment searchDepartment) {
|
||||
// this.httpSession = httpSession;
|
||||
// this.searchDepartment = searchDepartment;
|
||||
// }
|
||||
//
|
||||
// @ModelAttribute
|
||||
// public SearchConditionDepartmentForm searchConditionDepartmentForm() {
|
||||
// return new SearchConditionDepartmentForm();
|
||||
// }
|
||||
//
|
||||
// @PermissionCheck
|
||||
// @SessionCheck
|
||||
// @RequestMapping(value = TransitionTargetPageNameKeyword.SHOW_UPDATE_DEPARTMENT, method = RequestMethod.POST))
|
||||
// public String showUpdateDepartment(@RequestParam("idDepartment") Integer idDepartment, Model model) {
|
||||
// final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||
//
|
||||
// try {
|
||||
//
|
||||
// model.addAttribute(PageReturnAttributeKeyword.DEPARTMENT_FORM_LIST, DepartmentForm.convertFrom(searchDepartment.selectAll()));
|
||||
//
|
||||
// List<Department> departmentInfoList = SearchDepartmentInfo.seachBy(
|
||||
// new SearchConditionDepartment(idDepartment,
|
||||
// null));
|
||||
//
|
||||
// if (departmentInfoList.isEmpty()) {
|
||||
// model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||
// return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO;
|
||||
//
|
||||
// model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_INFO_FORM, UpdateDepartmentInfoForm.convertFrom(departmentInfoList.get(0)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
package com.example.rhizome.app.presentation.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.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 org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.example.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Department;
|
||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||
import com.example.rhizome.app.presentation.form.UpdateDepartmentInfoForm;
|
||||
|
||||
@Controller
|
||||
public class UpdateDepartmentController {
|
||||
|
||||
// ログ出力用インスタンス
|
||||
private final static Logger LOGGER = Logger.getLogger(UpdateDepartmentController.class.getName());
|
||||
// エラーメッセージ用の定数フィールド
|
||||
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||
|
||||
private final HttpSession httpSession;
|
||||
private final SearchDepartment searchDepartment;
|
||||
|
||||
@Autowired
|
||||
public UpdateDepartmentController(HttpSession httpSession, SearchDepartment searchDepartment) {
|
||||
this.httpSession = httpSession;
|
||||
this.searchDepartment = searchDepartment;
|
||||
|
||||
}
|
||||
|
||||
@ModelAttribute
|
||||
public SearchConditionDepartmentForm searchConditionDepartmentForm() {
|
||||
return new SearchConditionDepartmentForm();
|
||||
}
|
||||
|
||||
@PermissionCheck
|
||||
@SessionCheck
|
||||
@RequestMapping(value = "/showUpdateDepartment", method = RequestMethod.POST)
|
||||
public String showUpdateDepartment(@RequestParam("idDepartment") Integer idDepartment, Model model) {
|
||||
final String UPDATE_TARGET_ID_NOT_FOUND = "更新対象のデータが見つかりません。";
|
||||
|
||||
try {
|
||||
|
||||
List<Department> departmentInfoList = searchDepartment.searchBy(
|
||||
new SearchConditionDepartment(idDepartment, null));
|
||||
|
||||
if (departmentInfoList == null || departmentInfoList.isEmpty()) {
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR,
|
||||
new MessageForm(UPDATE_TARGET_ID_NOT_FOUND));
|
||||
|
||||
return "forward:" + TransitionTargetPageNameKeyword.SELECT_DEPARTMENT_INFO_FORM_EMPTY;
|
||||
}
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_FORM,
|
||||
UpdateDepartmentInfoForm.convertForm(departmentInfoList.get(0)));
|
||||
|
||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||
|
||||
} catch (Exception e) {
|
||||
httpSession.invalidate();
|
||||
e.printStackTrace();
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.example.rhizome.app.presentation.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.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.rhizome.aop.aspect.PermissionCheck;
|
||||
import com.example.rhizome.aop.aspect.SessionCheck;
|
||||
import com.example.rhizome.app.domain.model.Department;
|
||||
import com.example.rhizome.app.domain.model.SearchConditionDepartment;
|
||||
import com.example.rhizome.app.domain.service.SearchDepartment;
|
||||
import com.example.rhizome.app.domain.service.UpdateDepartment;
|
||||
import com.example.rhizome.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||
import com.example.rhizome.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||
import com.example.rhizome.app.presentation.form.MessageForm;
|
||||
import com.example.rhizome.app.presentation.form.SearchConditionDepartmentForm;
|
||||
import com.example.rhizome.app.presentation.form.UpdateDepartmentInfoForm;
|
||||
|
||||
@Controller
|
||||
public class UpdateDepartmentResultController {
|
||||
|
||||
// ログ出力用インスタンス
|
||||
private final static Logger LOGGER = Logger.getLogger(UpdateDepartmentController.class.getName());
|
||||
// エラーメッセージ用の定数フィールド
|
||||
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||
|
||||
private final HttpSession httpSession;
|
||||
private final SearchDepartment searchDepartment;
|
||||
private final UpdateDepartment updateDepartment;
|
||||
|
||||
@Autowired
|
||||
public UpdateDepartmentResultController(HttpSession httpSession, SearchDepartment searchDepartment,
|
||||
UpdateDepartment updateDepartment) {
|
||||
this.httpSession = httpSession;
|
||||
this.searchDepartment = searchDepartment;
|
||||
this.updateDepartment = updateDepartment;
|
||||
}
|
||||
|
||||
@ModelAttribute
|
||||
public SearchConditionDepartmentForm searchConditionDepartmentForm() {
|
||||
return new SearchConditionDepartmentForm();
|
||||
}
|
||||
|
||||
@PermissionCheck
|
||||
@SessionCheck
|
||||
@RequestMapping(value = "/updateDepartmentResult", method = RequestMethod.POST)
|
||||
public String departmentUpdateResult(
|
||||
@ModelAttribute("updateDepartmentInfoForm") UpdateDepartmentInfoForm updateDepartmentInfoForm,
|
||||
Model model) {
|
||||
|
||||
final String NOTHING = "項目が空欄です。";
|
||||
final String DUPLICATION = "既に同名の部署が存在するか、値が変更されていません。";
|
||||
final String NO_TARGET = "更新対象のデータが見つかりません。";
|
||||
final String UPDATE_COMPLETE = "更新が完了しました。";
|
||||
|
||||
try {
|
||||
|
||||
// 必須入力チェック
|
||||
if (UpdateDepartmentInfoForm.hasErrorParameter(updateDepartmentInfoForm)) {
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NOTHING));
|
||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||
}
|
||||
|
||||
List<Department> beforeList = searchDepartment.searchBy(
|
||||
new SearchConditionDepartment(updateDepartmentInfoForm.getIdDepartment(), null));
|
||||
|
||||
if (beforeList == null || beforeList.isEmpty()) {
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(NO_TARGET));
|
||||
return "forward:/selectDepartment";
|
||||
}
|
||||
Department beforeDepartment = beforeList.get(0);
|
||||
Department updateDepartmentData = UpdateDepartmentInfoForm.convertTo(updateDepartmentInfoForm);
|
||||
|
||||
if (Objects.equals(beforeDepartment.getNmDepartment(), updateDepartmentData.getNmDepartment())) {
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||
}
|
||||
|
||||
List<Department> duplicationList = searchDepartment.searchBy(
|
||||
new SearchConditionDepartment(null, updateDepartmentData.getNmDepartment()));
|
||||
|
||||
if (duplicationList != null && !duplicationList.isEmpty()) {
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_ERROR, new MessageForm(DUPLICATION));
|
||||
model.addAttribute(PageReturnAttributeKeyword.UPDATE_DEPARTMENT_INFO_FORM, updateDepartmentInfoForm);
|
||||
return TransitionTargetPageNameKeyword.UPDATE_DEPARTMENT_INPUT_HTML;
|
||||
|
||||
}
|
||||
|
||||
// 更新を実行 ➔ forward
|
||||
updateDepartment.updateDepartment(beforeDepartment, updateDepartmentData);
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE_INFO, new MessageForm(UPDATE_COMPLETE));
|
||||
return "forward:/selectDepartment";
|
||||
|
||||
} catch (
|
||||
|
||||
Exception e) {
|
||||
httpSession.invalidate();
|
||||
e.printStackTrace();
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ public class PageReturnAttributeKeyword {
|
||||
public static final String LOGIN_INFO_FORM = "loginInfoForm";
|
||||
public static final String UPDATE_PERSONAL_EMPLOYEE_USER_FORM = "updatePersonalEmployeeUserForm";
|
||||
public static final String EMPLOYEE_INFO_FORM_LIST = "employeeInfoFormList";
|
||||
public static final String UPDATE_DEPARTMENT_FORM = "updateDepartmentForm";
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public class TransitionTargetPageNameKeyword {
|
||||
public static final String INSERT_EMPLOYEE_RESULT_HTML = "insertEmployeeResult";
|
||||
public static final String INSERT_DEPARTMENT_RESULT_HTML = "insertDepartmentResult";
|
||||
public static final String UPDATE_EMPLOYEE_INPUT_HTML = "updateEmployeeInput";
|
||||
public static final String UPDATE_DEPARTMENT_INPUT_HTML = "updateDepartmentInput";
|
||||
|
||||
public static final String ERROR_HTML = "error";
|
||||
|
||||
@@ -55,10 +56,11 @@ public class TransitionTargetPageNameKeyword {
|
||||
public static final String INSERT_DEPARTMENT_CONFIRM = "/insertDepartmentConfirm";
|
||||
public static final String INSERT_DEPARTMENT = "/insertDepartment";
|
||||
public static final String SELECT_DEPARTMENT_INFO = "/selectDepartment";
|
||||
public static final String SELECT_DEPARTMENT_INFO_FORM_EMPTY = "/selectAll";
|
||||
public static final String SHOW_UPDATE_DEPARTMENT = "/showUpdateDepartment";
|
||||
public static final String UPDATE_DEPARTMENT_RESULT = "/updateDepartmentResult";
|
||||
|
||||
public static final String SELECT_DEPARTMENT_INFO_FORM_EMPTY = "/selectDepartmentAll";
|
||||
|
||||
|
||||
// HTML
|
||||
// Controller
|
||||
|
||||
@@ -90,6 +92,7 @@ public class TransitionTargetPageNameKeyword {
|
||||
INSERT_DEPARTMENT,
|
||||
INSERT_DEPARTMENT_CONFIRM,
|
||||
SELECT_DEPARTMENT_INFO,
|
||||
SELECT_DEPARTMENT_INFO_FORM_EMPTY,
|
||||
SHOW_UPDATE_DEPARTMENT,
|
||||
UPDATE_DEPARTMENT_RESULT
|
||||
);
|
||||
|
||||
@@ -1,54 +1,48 @@
|
||||
//package com.example.rhizome.app.presentation.form;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.example.rhizome.app.domain.model.Department;
|
||||
//
|
||||
//import lombok.AllArgsConstructor;
|
||||
//import lombok.Data;
|
||||
//import lombok.NoArgsConstructor;
|
||||
//
|
||||
//@Data
|
||||
//@AllArgsConstructor
|
||||
//@NoArgsConstructor
|
||||
//public class UpdateDepartmentInfoForm {
|
||||
//
|
||||
// private Integer idDepartment;
|
||||
//
|
||||
// private String nmDepartment;
|
||||
//
|
||||
// public static UpdateDepartmentInfoForm convertForm(Department department) {
|
||||
// return new UpdateDepartmentInfoForm(
|
||||
// department.getIdDepartment(),
|
||||
// department.getNmDepartment());
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public static List<UpdateDepartmentInfoForm> convertForm(List<Department> departmentList) {
|
||||
// return departmentList.stream().map(UpdateDepartmentInfoForm::convertFrom).toList();
|
||||
// }
|
||||
//
|
||||
// public static Department convertTo(UpdateDepartmentInfoForm updateDepartmentInfoForm) {
|
||||
// return new Department(
|
||||
// updateDepartmentInfoForm.getIdDepartment(),
|
||||
// updateDepartmentInfoForm.getNmDepartment());
|
||||
// }
|
||||
//
|
||||
// public static boolean hasErrorParameter(UpdateDepartmentInfoForm updateDepartmentInfoForm) {
|
||||
//
|
||||
// boolean errorFlag = !isNullOrBlank(updateDepartmentInfoForm.getNmDepartment());
|
||||
//
|
||||
// if (!isNullOrBlank(updateDepartmentInfoForm.getNmDepartment())) {
|
||||
// errorFlag = true;
|
||||
// }
|
||||
//
|
||||
// return errorFlag;
|
||||
// }
|
||||
//
|
||||
// private static boolean isNullOrBlank(String str) {
|
||||
// if (null == str) {
|
||||
// return true;
|
||||
// }
|
||||
// return str.isBlank();
|
||||
// }
|
||||
//}
|
||||
package com.example.rhizome.app.presentation.form;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.rhizome.app.domain.model.Department;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UpdateDepartmentInfoForm {
|
||||
|
||||
private Integer idDepartment;
|
||||
|
||||
private String nmDepartment;
|
||||
|
||||
public static UpdateDepartmentInfoForm convertForm(Department department) {
|
||||
return new UpdateDepartmentInfoForm(
|
||||
department.getIdDepartment(),
|
||||
department.getNmDepartment());
|
||||
|
||||
}
|
||||
|
||||
public static List<UpdateDepartmentInfoForm> convertForm(List<Department> departmentList) {
|
||||
return departmentList.stream().map(UpdateDepartmentInfoForm::convertForm).toList();
|
||||
}
|
||||
|
||||
public static Department convertTo(UpdateDepartmentInfoForm updateDepartmentInfoForm) {
|
||||
return new Department(
|
||||
updateDepartmentInfoForm.getIdDepartment(),
|
||||
updateDepartmentInfoForm.getNmDepartment());
|
||||
}
|
||||
|
||||
public static boolean hasErrorParameter(UpdateDepartmentInfoForm updateDepartmentInfoForm) {
|
||||
|
||||
return isNullOrBlank(updateDepartmentInfoForm.getNmDepartment());
|
||||
}
|
||||
|
||||
private static boolean isNullOrBlank(String str) {
|
||||
if (null == str) {
|
||||
return true;
|
||||
}
|
||||
return str.isBlank();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,8 +78,7 @@
|
||||
<td th:text="${departmentForm.nmDepartment}"></td>
|
||||
<td>
|
||||
<!-- 更新フォーム -->
|
||||
<form action="showUpdateDepartment" method="post" style="display: inline;">
|
||||
|
||||
<form action="/updateDepartmentResult" method="post" style="display: inline;">
|
||||
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||
<input type="submit" value="更新">
|
||||
</form>
|
||||
@@ -89,6 +88,7 @@
|
||||
<input name="idDepartment" th:value="${departmentForm.idDepartment}" type="hidden">
|
||||
<input type="submit" value="削除">
|
||||
</form>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<h1>
|
||||
部署情報更新
|
||||
<div class="rightSection">
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmDepartment}"></span></span>
|
||||
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
|
||||
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
|
||||
</div>
|
||||
</h1>
|
||||
@@ -49,13 +49,14 @@
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
<a href="javascript:selectSubmit()">一覧に戻る</a>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
function selectSubmit() {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('action', 'selectAll');
|
||||
form.setAttribute('action', 'selectDepartment');
|
||||
|
||||
// 動的送信用のHidden
|
||||
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||
|
||||
@@ -3,40 +3,40 @@
|
||||
|
||||
<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>
|
||||
<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>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>更新が完了しました</h2>
|
||||
<br/>
|
||||
<a href="javascript:backSubmit()">戻る</a>
|
||||
<h2>更新が完了しました</h2>
|
||||
<br />
|
||||
<a href="javascript:backSubmit()">戻る</a>
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
function backSubmit() {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('action', 'updatePersonalEmployeeResult');
|
||||
function backSubmit() {
|
||||
const form = document.createElement('form');
|
||||
form.setAttribute('method', 'post');
|
||||
form.setAttribute('action', 'updatePersonalEmployeeResult');
|
||||
|
||||
// 動的送信用のHidden
|
||||
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||
const inputField = document.createElement("input");
|
||||
inputField.setAttribute("type", "hidden");
|
||||
inputField.setAttribute("value", "updatePersonalEmployeeResult");
|
||||
// 動的送信用のHidden
|
||||
// 動的にFormを作成する場合は何かしら送信しないと、正しく動作しない
|
||||
const inputField = document.createElement("input");
|
||||
inputField.setAttribute("type", "hidden");
|
||||
inputField.setAttribute("value", "updatePersonalEmployeeResult");
|
||||
|
||||
form.appendChild(inputField);
|
||||
form.appendChild(inputField);
|
||||
|
||||
// フォームをDOMに追加
|
||||
document.body.appendChild(form);
|
||||
// フォームをDOMに追加
|
||||
document.body.appendChild(form);
|
||||
|
||||
form.submit();
|
||||
}
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user