티스토리 뷰
1 2 3 4 5 | package command; public interface Order { public void execute(); } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | package command; import javax.servlet.http.HttpServletRequest; import lombok.Data; @Data public class Command implements Order{ protected HttpServletRequest request; protected String action,domain,page,view; @Override public void execute() { this.view = "/WEB-INF/view/"+domain+"/"+page+".jsp"; } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | package command; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import enums.Action; public class Commander { public static Command order( HttpServletRequest request, HttpServletResponse response){ Command cmd = null; switch (Action.valueOf( request.getParameter("action") .toUpperCase())) { case MOVE: System.out.println("---무브진입---"); cmd = new MoveCommand(request); break; case JOIN: System.out.println("---조인진입---"); cmd = new CreateCommand(request); break; case LIST: cmd = new ListCommand(request); break; case SEARCH: cmd = new SearchCommand(request); break; case RETRIEVE: cmd = new RetrieveCommand(request); break; case COUNT: cmd = new CountCommand(request); break; case UPDATE: cmd = new UpdateCommand(request); break; case DELETE: System.out.println("=== DELETE CMD 1==="); cmd = new DeleteCommand(request); System.out.println("=== DELETE CMD 2==="); break; case LOGIN: cmd = new LoginCommand(request); break; default: break; } return cmd; } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 | package command; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Receiver { public static Command cmd=new Command(); public static void init( HttpServletRequest request, HttpServletResponse response){ cmd = Commander.order(request,response); } } | cs |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | package command; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Carrier { public static void forward(HttpServletRequest request, HttpServletResponse response) { try { System.out.println("Sentry.cmd.getView() is " +Receiver.cmd.getView()); request .getRequestDispatcher(Receiver.cmd.getView()) .forward(request, response); } catch (Exception e) { e.printStackTrace(); } } public static void redirect( HttpServletRequest request, HttpServletResponse response,String url){ try { response.sendRedirect(request.getContextPath()+url); } catch (Exception e) { e.printStackTrace(); } } } | cs |
'1. 자바' 카테고리의 다른 글
main-swing-vo Lotto (0) | 2020.05.24 |
---|---|
Fwd: 디자인패턴 종류 블로그 참조 (0) | 2020.05.24 |
Txt: 클래스다이어그램 관계도 (0) | 2020.05.24 |
[객체자바문법] 얕은 복사 vs. 깊은 복사 (0) | 2020.05.19 |
자바/스프링/2020-05-12/ 인텔리제이에서 마이바티스, 마리아디비 설정 (0) | 2020.05.12 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SpringBoot
- mariadb
- springMVC
- Mlearn
- docker
- JPA
- ERD
- maven
- SQLAlchemy
- Java
- vscode
- Django
- JUnit
- COLAB
- jQuery
- Algorithm
- Mongo
- database
- FLASK
- tensorflow
- AWS
- React
- KAFKA
- Python
- terms
- intellij
- nodejs
- Oracle
- Git
- Eclipse
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함