Skip to content

MVC 프레임워크 1단계 실습#3

Merged
javajigi merged 13 commits intocode-squad:brainbackdoorfrom
brainbackdoor:brainbackdoor
Nov 3, 2017
Merged

MVC 프레임워크 1단계 실습#3
javajigi merged 13 commits intocode-squad:brainbackdoorfrom
brainbackdoor:brainbackdoor

Conversation

@brainbackdoor
Copy link

MVC 프레임워크 1단계 실습

@Override
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
RequestMapping requestmapping = new RequestMapping();
requestmapping.init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이와 같이 구현할 경우 발생하는 이유는 뭘까요?
사용자 요청이 있을 때마다 초기화 작업을 진행하게 됨.

Controller controller = requestmapping.getController(req.getRequestURI());
try {
String view = controller.execute(req, resp);
JspView jspView = new JspView(view);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1단계 실습은 JspView를 사용하지 말고 구현하는 것임.
JspView를 사용하지 말고 구현해 볼 것을 추천함.


@Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
return "index.jsp";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

req.setAttribute("users", DataBase.findAll());

jsp에 데이터를 전달하는 부분이 있어야 되지 않을까?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.jsp에서는 users 데이터를 사용하지 않는것 같아서 url만 리턴하였습니다.


@WebServlet(value = { "/users/login", "/users/loginForm" })
public class LoginController extends HttpServlet {
public class LoginController extends HttpServlet implements Controller {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

더 이상 HttpServlet을 상속할 필요가 없음.

@javajigi javajigi merged commit 3a5dd6c into code-squad:brainbackdoor Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants