전체 글
-
servlet-context (controller 작동 방식)Spring 2023. 3. 27. 15:12
스프링의 동작 방식 - 은 /resources/** 패턴과 일치하는 리소스에 대한 HTTP GET 요청을 처리하고, 웹 애플리케이션의 루트 디렉토리 아래 /resources/ 디렉토리에 있는 정적 리소스를 제공합니다 이 것은 효율적으로 처리되며 서버 부하를 줄이고 성능을 향상시키는 데 도움이 된다. 은 Spring 컨트롤러에서 렌더링을 위해 선택된 뷰를 웹 애플리케이션의 /WEB-INF/views/ 디렉토리에 있는 JSP 리소스로 해결하기 위한 뷰 리졸버를 설정합니다. 이를 통해 JSP 파일을 보안 상태로 유지하고 컨트롤러 메서드를 통해서만 접근할 수 있도록 합니다. prefix 속성은 뷰 이름의 접두사를 설정하고, suffix 속성은 뷰 이름의 접미사를 설정합니다. 이 두 속성을 함께 사용하여 렌더링에..
-
eclips 에서 Spring 다운로드 / 실행Spring 2023. 3. 27. 11:16
1. 스프링을 eclips에 다운받고싶으면, eclips의 help -> About Eclipse IDE 에서 이클립스의 버전을 확인해야한다. 2. help -> install new software work with 에 적합한 버전의 spring 다운로드 소스를 넣고 Add... 실행 - 프로그램들이 추가된 것을 확인한 후 Select All , next ** 이클립스 버전에 따라 설치가 되지 않을 수 있기 때문에 이 부분에 유의하자 3. SpringEx 폴더를 사용할 워크스페이스에 넣고 Open Project from File System -> Directory 를 클릭해서 SpringEx 폴더를 import 한다. SpringEx 가 추가된 모습 test 폴더에서 파일을 만들어 작동하는지 확인해보고..
-
MVC 패턴 구현카테고리 없음 2023. 3. 27. 09:40
MVC 패턴 : 개발에 있어서 프론트 엔드와 백 엔드가 한 파일에 묶여있다면, 협업 시에 프론트엔드를 작업하는 중에는 백 엔드 작업을 못 하고 백 엔드 작업 중에 프론트 엔드 작업을 할 수 없는 불편함이 발생한다. 이를 해결하기 위해 만들어졌다. 모델 1구조 : JSP를 이용한 단순 모델, 웹 브라우저 상의 요청을 JSP가 직접 처리한다. 따라서 JSP 페이지에서 비즈니스 로직을 처리하기 위한 코드와 웹 브라우저에 결과를 출력하는 코드가 섞인다. 모델 2구조 : 모델 1과는 달리 웹 브라우저의 요청을 하나의 서블릿이 받는다. 서블릿은 웹 브라우저의 요청을 알맞게 처리한 후 그 결과를 보여줄 JSP 페이지로 포워딩한다. 웹 브라우저의 모든 요청을 단일 진입점, 하나의 서블릿에서 처리한다. 따라서 서블릿은 ..
-
커넥션 풀JSP 2023. 3. 27. 09:16
커넥션 풀 : 데이터베이스와 연결된 커넥션을 미리 만들어서 풀 속에 저장해 두고 있다가 필요할 때 커넥션 풀에서 가져다 쓴다. ( 한 웹 서버를 개발할 때 각 페이지마다 메모리를 소모할 필요 없이 커넥션 풀을 이용해 메모리 소모를 줄인다.) - 예를 들어 위와 같은 class를 모든 페이지마다 생성할 필요가 없다. - DBCP를 이용해서 커넥션 풀 사용하기 1. DBCP 관련 jar 파일과 JDBC 드라이버 jar 파일 설치하기 2. 커넥션 풀 초기화 3. 커넥션 풀로부터 커넥션 사용하기
-
제약조건 확인, 제약조건 제거Sql 2023. 3. 24. 09:43
테이블에 걸린 제약조건을 확인할 수 있다. 모든 테이블에 걸린 제약조건 확인 select * from information_schema.table_constraints; 특정 테이블에 걸린 제약조건 확인 select * from information_schema.table_constraints where table_name = '테이블명'; - 제약조건에 이름을 지정하지 않고 만들었더라도 자동으로 부여된 이름을 찾을 수 있다. 제약조건 제거 alter table 테이블명 drop 제약조건 제약조건명;
-
게시판 작동 원리JSP 2023. 3. 23. 15:28
목록에서 게시글로 이동할 때 게시판 목록창에서 사용자가 게시글을 클릭하면 특정 페이지로 이동할 수 있게 a태그를 이용한다. 이 때 primary key로 등록된 no 요소를 URL 뒤쪽에 붙여서 넘겨주는 것이 좋다. 게시글에서 데이터 불러오기 a 태그에 입력된 페이지에서는 파라메터를 받아서 저장하고( number ) , 데이터베이스에 연결해서 해당 자료를 받아온다 * 이 때 파라메터에 저장된 값의 타입에 주의해야한다. - 명령문에 데이터를 넣을 때 위와 같은 형태면 불편하다. 그래서 prepareStatement를 이용할 수 있다. prepareStatement사용방법 (교재 P. 401) 1. Connection.prepareStatement() 메서드를 사용해서 PreparedStatement 생성 ..