[ADD] コース選択画面に遷移するCourseControllerを作成しました。
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
package com.example.demo.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.service.CourseInfoService;
|
||||||
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
|
import com.example.demo.app.presentation.form.CourseForm;
|
||||||
|
import com.example.demo.app.presentation.form.CourseInfoForm;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CourseController {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(CourseController.class.getName());
|
||||||
|
// エラーメッセージ用の定数フィールド
|
||||||
|
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
|
||||||
|
|
||||||
|
// private final HttpSession httpSession;
|
||||||
|
private final CourseService courseService;
|
||||||
|
private final CourseInfoService courseInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/select-course")
|
||||||
|
public String select(Model model) {
|
||||||
|
|
||||||
|
//try {
|
||||||
|
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
||||||
|
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
|
return "select-course";
|
||||||
|
|
||||||
|
//} catch (Exception e) {
|
||||||
|
// // ログイン情報の破棄
|
||||||
|
// httpSession.invalidate();
|
||||||
|
//
|
||||||
|
// e.printStackTrace();
|
||||||
|
//
|
||||||
|
// // エラーログ出力
|
||||||
|
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
|
||||||
|
// // エラー画面遷移
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user