728x90
반응형
📚MVC ( Model View Controller )
⭐ Model View Controller의 약자
⭐ 소프트웨어가 서비스하는 방식에 대한 패턴 지정
⭐ 서비스를 하는 방식에 대한 하나의 디자인 패턴
⭐ 어플리케이션 서비스를 하기위해서 여러 처리가 필요
⭐ 각 기능 단위별로 나눠서 처리
⭐ 역활별 코드 작성에 따른 디버깅, 가독성 ⬆️
🧨Model
- DB에서 데이터를 가지고 올수 있고 가지고 있을 수도 있다.
- DB와 연동을 통해 Controller에 값을 전달 하고 View와 직접 소통은 없다.
🧨View
- 데이터를 전달받아 유저에게 제공된 화면을 보여줌
- Controller에게 데이터 및 엑션 정보를 전달받고 Controller와만 소통한다.
🧨Controller
- View에서 엑션, 이벤트에 대한 input값을 받음
- Model받은 데이터를 가공해서 View에게 전달 가능
------------------------------------------------------------------------------------------
🧨Controller
class Users{
function getProfile(id) {
profile = this.UserModel.getProfile(id)
renderView('users/profile', profile);
}
}
------------------------------------------------------------------------------------------
🧨Model
class UserModel {
fucntion getProfile(id) {
data = this.db.get('SELECT * from users WHERE id = id')
return data;
}
}
------------------------------------------------------------------------------------------
🧨View
<h1>{{profile.name}}</h1>
<ul>
<li>Email: {{profile.email}}</li>
<li>Phone: {{profile.Phone}}</li>
</ul>
📚 MVVM(Model-View-ViewModel)
Ref. https://hanamon.kr/mvc%eb%9e%80-mvc-design-pattern/
728x90
반응형
'❤️01_Java' 카테고리의 다른 글
#mybatis #태그 #구문 (0) | 2023.11.16 |
---|---|
#Hibernate란? #JPA #ORM (0) | 2023.11.16 |
#Null #개발자숙제 #Null이야기 (0) | 2023.11.15 |
#java #exception #CheckedException #UncheckedException #Runtime Exception #Error (1) | 2023.11.14 |
#JDBC #HikariCP #ibatis #mybatis #jpa #java #FrameWork (0) | 2023.11.08 |
댓글