전체 글
-
[spring] 의존성 주입 (DI) _ 어노테이션 없이 xml로 설정 (생성자, 수정자)Spring 2024. 7. 31. 19:17
HTML 삽입미리보기할 수 없는 소스 모든 객체지향 프로그래밍에 통용되는 개념이다. java를 배우기 때문에 spring을 기준으로 정리한다.✔ 의존성 주입 (Dependency Injection)✨ IoC(Inversion of Control) 의존성 주입을 얘기하기 전에 먼저 알고 가야 하는 개념이 있는데, 바로 IoC이다. 흔히 제어의 역전이라고 말한다. 의미는 번역 그대로 메소드나 객체의 호출 작업을 개발자가 결정하는 것 아니라 외부에서 결정하는 것을 의미한다. Spring에서 ApplicationContext는 IoC 컨테이너를 의미한다. 스프링 프레임워크를 예로 들면, Controller 같은 객체들의 동작 구현은 개발자가 하지만 해당 객체들이 어느 시점에 호출할지는 프레임워크가 제어한다. 개..
-
[JSP] MyBatis 적용_2(어노테이션 없이)JAVA/ORM 2024. 7. 30. 18:56
HTML 삽입미리보기할 수 없는 소스 https://hi-hahahoho.tistory.com/93저번 글에서는 configuration.xml과 sqlMapConfig.java 설정을 자세히 봤다. 이번에는 DataMapper.xml과 DAO간 어떻게 사용되는지 정리하겠다. jsp와 같은 앞단은 특별히 달라지는 것은 없다. ✔ DataDao⌨ SqlSessionMyBatis에서 데이터베이스와 실제 세션(sql 쿼리 실행을 준비)을 나타내는 객체이다. SQL 실행 및 트랜잭션 관리를 담당한다. openSession() 메서드를 호출하여 기본 세션을 열고 작업이 끝나면 해당 객체를 해제한다. 🔦 MyBatis는 List 자료구조를 반환한다. 여러 행을 조회할때, 해당 테이블의 모든 행을 조회하고 각 행을 ..
-
SqlSessionFactory 클래스 정리JAVA/ORM 2024. 7. 29. 19:22
▤ 목차" data-ke-type="html">HTML 삽입미리보기할 수 없는 소스 MyBatis를 배우는데 자연스럽게 사용하지만 궁금한 인터페이스가 있었다.SqlSessionFactory는 MyBatis 프레임워크에서 중요한 인터페이스 중 하나이다.이 인터페이스는 데이터베이스와의 연결을 설정하고 SQL 세션을 생성하는 역할을 한다.이름에서 알 수 있는 점은, Factory 패턴이 사용되었다는 점이다. ✔ SqlSessionFactory 인터페이스 정의SqlSessionFactory는 MyBatis에서 DB와의 연결을 설정하고 SQL 세션을 생성하는 인터페이스이다.MyBatis는 데이터베이스 접근 계층을 제공한다.개발자는 SQL 매퍼 파일을 통해 SQL 쿼리와 자바 객체 간의 매핑을 할 수 있다. ⌨..
-
[JSP] MyBatis 적용 (ORM/ 어노테이션 없이)JAVA/ORM 2024. 7. 29. 01:08
HTML 삽입미리보기할 수 없는 소스 ✔ ORM (Object Relation Mapping)✏️ 개념ORM이란 객체와 DB의 테이블을 Mapping 시켜 RDB 테이블을 객체지향적으로 사용할 수 있게 해주는 기술이다.관계형 데이터베이스 시스템 (MySQL, PostgreSQL..)은 테이블과 열로 구성된 데이터를 사용한다. 데이터는 객체이며 독립된 데이터와 독립된 함수를 지닌다. 객체지향 프로그래밍 언어( JAVA .. )는 클래스와 객체로 데이터를 구성한다. RDB 테이블은 객체지향적 특성(상속, 다형성 .. )* 등이 없어서 JAVA와 같은 객체지향적 언어로 접근하는 것이 쉽지 않다. 이러한 (객체 모델과 관계형 모델 간의) 불일치를 해결하기 위해서 ORM을 사용하면 보다 객체지향적으로 RDB를 사..
-
JSTL 오류 ) javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach>web( jsp, servlet )/jsp 2024. 7. 28. 12:47
javax.servlet.jsp.JspTagException: Don't know how to iterate over supplied "items" in <forEach> 해당 오류를 봤다.이건 불러오는 객체와 JSTL이 안맞아서 생기는 오류이다. 나는 dto 객체 하나를 가져오는 코드에 forEach를 사용해서 오류가 발생한것..ㅎ아예 읽지 못하는 것을 보고 신기했다!"해당 객체와 맞지 않는다." 라거나 "이 타입 혹은 객체를 못찾겠다." 아니고 아예 해당 jsql 무슨말이야? 라는 오류였다.<forEach> 이렇게 이 코드를 읽지 못하는 오류가 나는 것이 신기!
-
이클립스 오류 ) 서버 실행했는데 서버를 선택하라는 경우JAVA/기타 2024. 7. 27. 20:24
이클립스에서 서버를 실행했는데,오류메시지없이 서버를 선택하라는 창이 떴다. publishes and runs j2ee and java ee web projects and server configurations to a local tomcat server 이미 전에 톰켓을 사용해서 해당 서버를 찾으려해도 찾을 수 없다.사진과 같이 버튼 활성화도 안되어있다. 📌해결방법나는 첫번째 방법으로는 해결할 수 없었다.비슷한 상황이고 나에게 같은 에러가 발생할 수 있기에 검색결과를 정리해보고자 한다. 🔦방법 11. 현재, 파일을 열어 workspace를 들어간다.해당 프로젝트\.metadata\.plugins 경로를 찾아 들어간다. 2. 해당 파일을 찾아 삭제시킨다.- org.eclipse.wst.server.c..
-
MVC 모델Spring 2024. 7. 26. 15:32
▤ 목차" data-ke-type="html">HTML 삽입미리보기할 수 없는 소스 ✔ 환경 설정빌드 관리 도구는 maven을 사용한다.⌨ sevlet 생성할때 논리적인 이름을 만들면 된다. 프로젝트를 만들면 위와 같이 논리적 파일명도 지정된다. 💻 web.xmlweb.xml을 통해 프로젝트와 이름을 mapping할 수 있다. wmvc2 index.html index.jsp index.htm default.html default.jsp default.htm mvc pack.controller.HobbyController mvc /hobby.do 👏 web.xml이란?배포 서술자(Deployment Descriptor)라..