목록전체 글 (365)
seong

1. mapper 만들기 DELETE는 단순 요청만 하면 되기 때문에 resultType이 필요없다 2. 우선 delete 컨트롤러 만들어주자 3. jsp작성 여기까지 확인 삭제가 되었다. 하지만 여기서 끝나면 절대 안된다. 왜냐? 여기서 끝내버리면 삭제는 로그인을 하지않아도, 글쓴이가 아니더라도 아무나 삭제가 가능하게 된다. 그래서 인증 로직이 필요하다. 삭제를 위한 인증 로직 짜기 1. 로그인이 되어 있는지 확인 2. 게시글을 쓴 본인이 맞는지. 마지막으로 jsp에서는 로그인, 게시글 본인이 아니라면 삭제 버튼이 없게 수정

먼저 이전 로그인 까지 완성된 것 + 공부 진행 글쓰기 완성하기 UsersController (유저 인증을 위해 세션키 확인) Users로그인할 때 session의 키 값 이름으로 principal로 했다. 필요할 경우에 똑같은 키 값으로 찾아야한다. session은 서버쪽에서 영구적 저장을 하며, 브라우저가 종료 되어도 세션의 키 값은 남아있다, 하지만 브라우저를 닫으면 없어진다. 1. BoardsController 글쓰기 인증 체크 부분 세션에서 인증이 된 사용자라면 글쓰기 writeForm으로 이동 , 아니라면 다시 로그인 폼으로 이동 session은 오브젝트 타입이다 , 그래서 데이터를 받아 오려면 다운캐스팅을 해주고 호출해준다. 받아와서 값이 null이라면 redirect를 해준다 redirec..

Git 브랜치 명령어 명령어 뜻 예제 git branch 브랜치이름 "브랜치이름"으로 브랜치 생성 git branch write git branch 현재 가지고 있는 브랜치 확인 git branch git merge 브랜치이름 브랜치 병합(모두 덮어씌워짐) git branch write git reset --hard 해시코드 해당 "해시코드"로 돌아감.(이것을 하려면 로그를 항상 남겨줘야한다.) git reset --hard q23e git log 로그 남기기 ( q를 누르면 돌아간다. ) git log git reflog 현재 까지 남겼던 로그 모두 보기 git refolg 복제 하기 - clone 원하는 HTTPS 복사 저장할 폴더에서 Git Bash 켜기 git clone "복사 해둔 주소" (Sh..

기본 셋팅 깃헙에서 다운로드 https://github.com/codingspecialist/Springboot-MyBatis-Setting DB에 간단한 예제 테이블 추가 Controller package site.metacoding.red.web; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RestController; import lombok.RequiredArgsConstructor; import site.metacoding.red.domain.use..

1. 프로젝트 생성 2. 라이브러리 선택 하고 finish 3. properties server.port=8000 server.servlet.context-path=/ spring.mvc.view.prefix=/WEB-INF/views/ spring.mvc.view.suffix=.jsp spring.datasource.driver-class-name=oracle.jdbc.OracleDriver spring.datasource.url=jdbc:oracle:thin:@localhost:1521:xe spring.datasource.username=SCOTT spring.datasource.password=TIGER spring.jpa.hibernate.ddl-auto=create 4. build.gradle..

Products 테이블 생성 properties에서 ddl-auto는 테이블 생성을 해주는 역할을 한다. 결과 확인 자바에서 작성 했던 그대로 제대로 만들어져있다.

h2의 특징(inmemory 데이터 ) 메모리에서만 동작을 한다. 메모리에서만 동작 하기 때문에 서버를 끄면 DB도 같이 사라진다. 서버 재시작할 때 마다 데이터가 없어지는 단점이 있다, 그래서 공부할 때 주로 사용한다. 1. h2 DB 연결 하기 Gradle에 Connection 의존성 추가 implementation 'org.springframework.boot:spring-boot-starter-jdbc' properties에 추가 spring.h2.console.enabled=true spring.datasource.driver-class-name=org.h2.Driver spring.datasource.url=jdbc:h2:mem:test spring.datasource.username=sa s..

Your repositories New repository Repository 생성 생성 및 주소, 가이드 코드 Spring 프로젝트 올려보기 Spring로 가서 프로젝트 - Alt + Enter 프로젝트가 있는 폴더 접속 폴더에서 Git bash Here Git 명령어 git init 모든 파일 관리 - git add . (. 부분에 특정프로젝트 이름 넣으면 그 프로젝트만 관리) git commit -m “프로젝트 초기화 완료” 처음 실행 한다면 단순 commit만 하면 오류, 아래 run 코드 명령 실행 git config --global user.email "깃허브 아이디" git config --global user.name "깃헙 이름" 위의 코드 완료 했다면 다시 commit , 로그로 확인 ..