분류 전체보기
-
람다식언어/JAVA 2023. 7. 5. 17:07
1. 람다식이란? - 메서드를 하나의 식으로 표현 - 함수를 간략,명확한 식으로 표현 할 수 있게 해준다. - 람다식으로 메서드를 표현하면, 이름과 반환값이 사라지므로, 익명함수라고도 한다. int method() { return (int)(Math.random()*5) +1;} () -> {(int)(Math.random()*5)+1}; *모든 메서드는 기본적으로 클래스에 포함되어 있어야하므로, 필요한 메서드를 만드는 작업이 복잡하다. *람다식은 이를 간결하게 처리할 수 있도록 해준다. *람다식을 통해 매개변수를 전달하여 값을 return받을 수 도 있지만, 람다식 자체를 매개변수로 사용할 수 있다. 1.2 람다식 작성 - 메서드의 이름과 반환타입을 제거하고 선언부와 몸통부 사이에 ->를 추가한다. -..
-
Spring MVC02 - 다중파일 업로드Web/Spring 2023. 6. 30. 23:23
1. 파일 업로드를 위한 준비 API, servlet-context.xml설정 다중 파일 업로드를 위해 API를 다운받자. commons-fileupload, commons-io commons-fileupload commons-fileupload 1.2.1 commons-io commons-io 1.4 스프링 컨테이너에 servlet-context.xml 파일 업로드를 위한 클래스와 property를 설정해야한다. - 업로드할 파일의 최대사이즈와, 임시파일사이즈, 인코딩타입 등을 미리 정해두자 1.2 뷰 페이지 만들기 다중파일업로드 스프링 이용한 다중 파일 업로드 구현 Panel Content 아이디: 이름: 파일추가: 업로드 나프2탄고 form에 enctype ="multipart/form-data"로..
-
Seed PDB를 이용한 Pluggable 데이터 베이스 생성, 사용자 생성DataBase/Oracle 2023. 6. 29. 23:08
- DB가 있고, DB에 자원을 공유하는 작은 가상화된 DB를 생성하는 거이다. * 오라클을 통해 그냥 DB를 사용할 수도 있지만, DB가 잘못되면, 아예 다시 DB를 새로 깔아야한다. 가상화된 복사본 DB를 사용하면, 그냥 새로운 복사본만 만들면된다. -> 가상화하면 관리가 편하다. - 처음에 접속한 DB는 CDB (Root DB)이다. - CDB의 자원을 공유하는 가상화 DB를 사용하자. - Seed는 일종에 가상화 DB를 만들기 위한 템플릿이다. XEPDB는 Seed를 통해 생성된 기본 Pluggable DB sql plus로 다음과 같은 쿼리를 작성하면 seed와 xepdb를 볼 수 있다. -sql developer에서 XEPDB1 서버 접속 +눌러서 다음과 같이 설정하면 된다. * CDB와 PD..
-
데이터 베이스와 DBMS 개요DataBase/Oracle 2023. 6. 29. 22:21
> SQL- DBMS에게 질의하는 명령어 질의 - 무엇을? -> 구조화된 데이터들을 DBMS -> 데이터 베이스 관리 시스템 데이터 베이스와 DBMS의 개요 > 로컬서버에 DB가 따로 존재한다고 생각해보자 다음과 같은 문제점이 발생한다. - 데이터 중복이 심하다. - DB 갱신의 문제 - 각 로컬에서 갱신된 DB를 로컬별로 씽크작업이 필요해진다. - 갱신 중 각 DB는 상이한 데이터를 가지고 있을 것, 싱크작업 중 DB에 결함이 발생할 수 있다. --> DB를 한 곳에 두고, 중복을 없애는 방향으로 테이블을 쪼개자!, 각 테이블 별 참조는 관계형으로! > 로컬 단위로 DB를 가지고 있었을 때 발생하는 문제점을 일부 해결했지만, 위와 같은 방식도 단점이 존재함 -> 유효한 데이터를 위한 테이블 참조의 과정..
-
Spring MVC02 - Ajax MemberListWeb/Spring 2023. 6. 29. 21:49
- Servlet-jsp에서 ajax를 이용해서 회원리스트 보기를 했던 것과 동일한 작업을 할 것이다. 1. 화면 및 javascript 구성 회원리스트 출력 function btnClick(){ $.ajax({ url : "", type : "get", dataType : "json", success : resultHtml. error : function(){alert("error");} }); } function resultHtml(data){ console.log(data); var html = ""; html += " "; html += " 번호"; html += " 아이디"; html += " 비밀번호"; html += " 이름"; html += " 나이"; html += " 이메일"; html..
-
Spring MVC02 - 어노테이션을 이용한 Mapper 인터페이스 사용Web/Spring 2023. 6. 29. 21:19
- 사실 @Mapper 없어도 mybatis-spring scan을 통해 알아서 관리된다. (같은 패키지에 있고, namespace와 인터페이스명 같다면) - 어노테이션 이용방법 - 복잡한 sql아니면, 그냥 어노테이션으로 관리해도 된다. public interface MemberMapper { @Select("select * from member") public List memberList(); // 메서드 이름 sql id매칭 중요 @Insert(" insert into member(id, pass, name, age, email, phone)\r\n" + " values(\r\n" + " #{id},\r\n" + " #{pass},\r\n" + " #{name},\r\n" + " #{age},\r\..
-
Spring MVC02 - Mapper Interface와 XML이용한 CRUDWeb/Spring 2023. 6. 29. 21:10
- 기존 프로젝트에 DAO객체를 없애고 다른 방법으로 DB를 다루는 방식이 존재한다. - 인터페이스를 정의하고, 추상메서드와 sql을 연결하는 방법이다. (인터페이스 메서드명, mapper xml에 id랑 연결) DAO없이 인터페이스를 통해 DB작업을 하고 싶다면, 1. mapper 인터페이스 생성하고, @Mapper 어노테이션 사용 2. root.xml에 어노테이션과 scan등록하기 3. mapper파일 namespace와 인터페이스 이름 맞추기 (되도록 같은 경로에 두기) 4. 메서드 명과 xml에 각 태그에 id가 일치시키기 1. Mapper 인터페이스 생성 kr.bit.mapper 패키지와 MemberMapper 인터페이스를 정의해 두었다. @Mapper // MyBatis(SqlSessionFa..
-
Spring MVC01 - 스프링 동작 절차Web/Spring 2023. 6. 28. 17:06
- 스프링이 동작하는 절차를 쭉 따라가보자 - 기본적인 설정만 해주면 대부분은 미리 다운받아진 api가 처리해준다. 1. Web.xml실행 - 스프링이 구동되면 Web.xml파일을 읽기 시작한다. web.xml파일을 순서대로 읽으면서 리스너 클래스가 실행되며, 다음으로 root-context.xml을 읽기 시작한다. - 설명을 읽어보면, 스프링 컨테이너를 만든다고 하는데, 스프링 컨테이너란 스프링이 모든 객체를 관리 할 때 사용하는 장소로 객체를 관리하는 메모리 공간이다. 1.2 스프링 컨테이너 - Servlet 컨테이너가 요청을 받고 서블릿 생명주기를 관리한다면, Spring컨테이너는 웹프로그래밍을 하며 사용할 객체들을 미리 생성해두고 관리하는 메모리 공간이다. - 왜 Spring Container가 ..