diff --git a/VamPa/src/main/java/com/vam/controller/AdminController.java b/VamPa/src/main/java/com/vam/controller/AdminController.java index 786269c..0cfb6cf 100644 --- a/VamPa/src/main/java/com/vam/controller/AdminController.java +++ b/VamPa/src/main/java/com/vam/controller/AdminController.java @@ -2,9 +2,14 @@ package com.vam.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import com.vam.model.AuthorVO; +import com.vam.service.AuthorService; @Controller @RequestMapping("/admin") @@ -12,6 +17,9 @@ public class AdminController { private static final Logger logger = LoggerFactory.getLogger(AdminController.class); + @Autowired + private AuthorService authorService; + /* 관리자 메인 페이지 이동 */ @RequestMapping(value="main", method = RequestMethod.GET) public void adminMainGET() throws Exception{ @@ -44,6 +52,19 @@ public class AdminController { logger.info("작가 관리 페이지 접속"); } - + /* 작가 등록 */ + @RequestMapping(value="authorEnroll.do", method = RequestMethod.POST) + public String authorEnrollPOST(AuthorVO author, RedirectAttributes rttr) throws Exception{ + + logger.info("authorEnroll :" + author); + + authorService.authorEnroll(author); // 작가 등록 쿼리 수행 + + rttr.addFlashAttribute("enroll_result", author.getAuthorName()); // 등록 성공 메시지(작가이름) + + return "redirect:/admin/authorManage"; + + } + } diff --git a/VamPa/src/main/webapp/WEB-INF/views/admin/authorEnroll.jsp b/VamPa/src/main/webapp/WEB-INF/views/admin/authorEnroll.jsp index c75cb45..cd3bc0e 100644 --- a/VamPa/src/main/webapp/WEB-INF/views/admin/authorEnroll.jsp +++ b/VamPa/src/main/webapp/WEB-INF/views/admin/authorEnroll.jsp @@ -54,6 +54,42 @@