Skip to content

4주차 미션 / 서버 2조 박재하#2

Open
jaepar wants to merge 6 commits intoKonkuk-KUIT:mainfrom
jaepar:week4
Open

4주차 미션 / 서버 2조 박재하#2
jaepar wants to merge 6 commits intoKonkuk-KUIT:mainfrom
jaepar:week4

Conversation

@jaepar
Copy link
Copy Markdown
Member

@jaepar jaepar commented Apr 8, 2025

No description provided.

Copy link
Copy Markdown
Contributor

@kisusu115 kisusu115 left a comment

Choose a reason for hiding this comment

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

코드 깔끔하게 잘 작성해주신 것 같습니다!

추가적인 생각해볼 점들만 남겨보겠습니다.

<c:otherwise>
<a href="/user/login.jsp" type="button" class="btn btn-outline-primary me-2">Log-In</a>
<a href="/user/form.jsp" type="button" class="btn btn-primary">Sign-up</a>
</c:otherwise>
Copy link
Copy Markdown
Contributor

@kisusu115 kisusu115 Apr 13, 2025

Choose a reason for hiding this comment

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

2단계 미션에 간단히 언급 되었던, 클라이언트가 직접적으로 뷰에 접근하지 않도록 하는 리팩토링도 가능하다고 생각합니다!

jsp 파일 정보를 리턴하는 컨트롤러를 따로 두어 해당하는 url로 요청을 받는다면, 뷰를 담당하는 파일의 위치를 노출시키지 않고도 로직을 처리할 수 있을 것 같습니다. 자세한 사항은 예시코드 4week/step2-mvc 브랜치의 ForwardController 클래스를 참고해주시면 좋을 것 같아요.

이런 방식은 뷰에 대한 접근 제어뿐만 아니라, 컨트롤러를 통해 요청 흐름을 명확히 분리하고,
추후 인증/인가 로직을 삽입하거나 요청 전처리를 추가할 때도 유연하게 확장할 수 있는 장점이 있습니다!

또한 뷰 템플릿 역할을 하는 jsp는 서버에서 동적으로 HTML을 생성해주는 역할에 집중하고
클라이언트는 해당 결과만 받아보도록 설계하여 MVC 패턴의 목적에도 잘 부합한다고 생각합니다.

@WebServlet("/")
public class DispatcherServlet extends HttpServlet {
private RequestMapper requestMapper;
private static final String REDIRECT = "redirect:";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

redirect: 문자열에 대한 상수 선언 좋은 것 같습니다!

return "/user/list.jsp";
}

return "redirect:/user/login.jsp";
Copy link
Copy Markdown
Contributor

@kisusu115 kisusu115 Apr 13, 2025

Choose a reason for hiding this comment

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

navigation.jspf 파일의 comment에서 언급한 ForwardController 활용 시 리다이렉트 요청을 "redirect:/user/loginForm" 으로 보내어 파일의 위치가 노출되지 않을 것 같습니다!

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