전체 글
-
웹 어플리케이션 배포Web/환경설정 관련 2023. 7. 22. 23:45
1. 알아두어야할 사항 - Java EE는 WTP 플러그인을 기본적으로 포함한다. - WTP플러그인을 통해 이클립스에 등록된 임시 서버에 자동으로 웹 어플리케이션이 배치되고, 톰캣서버를 제어할 수 있다. - 만약 위와 같은 기능이 없다면, 프로젝트를 테스트하기 위해 매번 WAR파일로 만들어서, 톰캣서버 폴더 webapps에 이를 복사하고, 재시작하는 것을 반복해야한다. 2. 이클립스 임시 배치 폴더(톰캣 실행 환경) - 이클립스를 통해 자동으로 배포되는 임시 배치의 위치는 위와 같다. workspace\.metadata\.plugins\org.eclipse.wst.server.core (이클립스 워크플레이스를 통해 들어갈 수 있다.) - tmp폴더는 이클립스에 연동된 톰캣서버의 갯수(톰캣 실행 환경의 수..
-
Servlet-JSP MVC07 - 리스트에 이미지 띄우고, 상세페이지에서 파일보기Web/Servlet-JSP 2023. 7. 22. 23:35
1. 회원리스트에 이미지 띄우기 - MemberList.jsp에 회원정보 출력되는 테이블 휴대폰 번호 밑에 아래와 같이 이미지를 띄우도록 추가하면 된다. *이미지 파일의 경로는 루트디렉토리에 file_REPO폴더안에 있다. 태그를 이용해 루트 디렉토리는 자동으로 추가하고, 폴더명이랑 파일명만 적어두자 2. 회원상세페이지에 파일 띄우기 첨부파일 - 아래와 같이 div를 하나 추가해주자. - 삭제버튼을 추가했는데 로그인 + 첨부파일이 있을 경우에만 x버튼이 뜨도록 만들었다. 참고자료: 나프2탄(박매일) - 인프런 https://www.inflearn.com/course/%EB%82%98%ED%94%84-mvc-2/dashboard [NarP Series] MVC 프레임워크는 내 손에 [나프2탄] - 인프런 ..
-
스트림(2) - 중간 처리언어/JAVA 2023. 7. 14. 14:46
1. 요소 걸러내기(필터링) - 필터링을 위한 메서드는 distinct()와 filter()가 있다. - distinct()는 요소의 중복을 제거한다. >객체 스트림의 경우 equals메소드를 기준으로 판단한다. > IntStream,LongStream 등은 값의 중복을 제거한다. - filter()는 매개값인 Predicate가 true인 요소만 리턴한다. Predicate는 IntPredicate,LongPredicate,DoublePredicate등이 있다. (함수형 인터페이스임) (매개변수로 주어진 값을 통해 조건검사 - true나 false를 리턴하도록 람다식을 짜)[test()메서드] 2. 요소 변환(매핑) -매핑은 스트림을 다른 요소로 변환하는 중간 처리 기능을 한다. - mapXXX(), ..
-
스트림(1) - 스트림이란,리소스로 스트림 얻기언어/JAVA 2023. 7. 14. 13:50
1. 스트림이란? - java8부터 추가된 컬렉션 및 배열의 요소를 반복 처리하기 위해 등장. - 요소들이 하나씩 흘러가면서 처리된다는 의미를 가지고 있다. - 스티림을 통해 List를 반복처리하면 다음과 같다. Stream stream = list.stream(); stream.forEach(item -> //item처리); //StreamEx.ja public class StreamExample{ public static void main(String[] args){ Set set = new HashSet(); set.add("홍길동"); set.add("신용권"); set.add("김자바"); Stream stream = set.stream(); stream.forEach(System.out.pri..
-
- JavaNextStep - 숫자야구게임(1) - 단위테스트언어/JAVA 2023. 7. 10. 17:10
- 학습테스트 > 내가 만든 api를 테스트하는게 아니라, 다른 사람이 구현해 놓은 라이브러리가 어떻게 동작하는지 단위테스트를 통해 알아보는 것 학습테스트이다. > 새로운 라이브러리를 테스트 기반으로 할 수 있다. (빠르게 학습 가능해진다) > 학습 테스트를 통해 - 단위 테스트 방법 학습 - 단위 테스트 도구 사용법 익힐 수 있다. - 사용하는 API에 대한 학습 효과가 있다. 1. String 클래스에 대한 학습 테스트 1.1 요구사항 1에 대해 @DisplayName("split Test") @Test void splitTest(){ String[] input = "1,2".split(","); assertThat(input).contains("1","2"); } @Test void splitTes..
-
-JavaNextStep (1) - Junit언어/JAVA 2023. 7. 10. 15:10
1. 객체지향 생활 체조 원칙 한 메서드에 오직 한 단계의 들여쓰기만 한다. else 예약어를 쓰지 않는다. 모든 원시 값과 문자열을 포장한다. 한 줄에 점을 하나만 찍는다. 줄여 쓰지 않는다(축약 금지). 모든 엔티티를 작게 유지한다. 3개 이상의 인스턴스 변수를 가진 클래스를 쓰지 않는다. 일급 컬렉션을 쓴다. getter/setter/프로퍼티를 쓰지 않는다. 2. 단위테스트란? - 하나의 모듈을 기준으로 독립적으로 진행되는 가장 작은 단위의 테스트이다. - 여기서 모듈은 애플리케이션에서 작동하는 하나의 기능 또는 메소드이다. 2.1 main method의 용도 > 프로그램 시작 > 구현 프로그램 테스트 > main method는 프로덕션코드 프로그램 구현을 담당하는 부분으로, 실제 사용하는 소스코드..
-
중첩 선언과 익명 객체언어/JAVA 2023. 7. 7. 13:53
1. 중첩클래스 - 객체 지향 프로그램에서 클래스간 긴밀한 관계 맺고 상호작용 - 클래스가 여러 클래스와 관계를 맺는 경우 독립 선언 - 특정 클래스와 관계를 맺는 경우에는 중첩 클래스로 선언 -> 유지보수에 도움, 코드 복잡성 줄이기, 클래스 멤버 쉽게 접근 - 크게 멤버클래스(인스턴스,static)와 로컬 클래스로 나눌 수 있다. 1.1 중첩클래스 저장 -outter$inner.class -A $1 inner.class로 저장됨 2. 멤버클래스 (인스턴스,static) > 공통점: 접근제한자 public,default,private을 가질 수 있다. 외부클래스 멤버 쉽게 접근 가능, 외부클래스는 내부클래스 멤버에 접근하려면 내부 클래스를 생성해야함 > 차이점 인스턴스 inner : outter클래스의..
-
상속,동적생성언어/JAVA 2023. 7. 6. 16:40
1. 상속 부모 클래스의 필드와 메서드를 자식 클래스에게 물려주는 것 2. 클래스 상속 *정적멤버와 생성자, 초기화 블럭등은 상속안됨 *인스턴스 멤버,메서드 중 public이나 protected만 super를 통해 가져올 수 있다. 3 부모생성자 호출 super() - 부모에 필요, 다른 생성자 있으면, 자식이 따로 호출해줘야함 자식 객체가 생성되면 부모가 먼저 생성된 후에 자식이 생성됨 4. 메소드 재정의 - 오버라이딩 ->다형성의 초석 - 부모의 메서드의 반환타입,메서드명,매개변수 일치하고 구현내용만 달라야한다. - 공변반환타입으로 리턴타입을 자식 클래스로 둘 수 도 있단다. - 접근제한자 좁게 불가, 새로운 예외( 더 많은 예외) 던질 수 없음 *메서드 재정의시 부모메서드 호출하고, 필요부분만 수정..