SpringFrameWork
-
SpringFramework를 이용한 웹사이트 만들기(10)-- 로그인,로그아웃 기능SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 26. 11:59
오늘은 로그인과 로그아웃기능을 구현 해보도록 하겠습니다. 아이디와 비밀번호를 받아와주시고 session,response,request를 받아와줍니다. 그리고 if문을 사용하여 vo가 비어있지 않고 = 비밀번호가 일치하고 = 가입중인 유저라면, 유저등급과 이름,이메일, 아이디를 session에 담아주고 로그인을 할 수 있도록 해줍니다. 문으로 세션에 담아있는 level로 비교를 하여 로그인을 안했으면 로그인버튼만 출력 하도록하고, 관리자는 관리자페이지, 일반 유저는 마이페이지 버튼을 출력하도록 설정해줍니다. 로그인을 할때 ~~님 로그인되었다는 메세지를 출력해주며 로그인을 해줍니다. 만약 아이디나 비밀번호가 일치하지 않는다면 다시 확인해달라는 메세지를 내보내어 로그인이 불가하도록 설정 하였습니다. 밑 사진이..
-
SpringFramework를 이용한 웹사이트 만들기(9)--회원가입 완료SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 25. 11:15
회원 가입을 할때 보안을 위해 BcryptPasswordEncoder를 이용하여 비밀번호를 암호화를 해줄겁니다. 일단 pom.xml에 라이브러리를 집어 넣어줍시다. org.springframework.security spring-security-core 5.6.0 org.springframework.security spring-security-web 5.6.0 org.springframework.security spring-security-config 5.6.0 그다음 servlet-context.xml에서 Bean에 등록을 해줍니다. 그다음 컨트롤러에서 암호화를 사용할 수 있도록 임포트를 걸어줍니다. 수정사항(birth - 10바이트 변경 ) 회원 가입을 누를때 아이디,이메일 중복을 확인 후 확인이 완..
-
SpringFramework를 이용한 웹사이트 만들기(8)--회원가입의 아이디, 이메일 중복체크를 해보자(Ajax를 사용)SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 24. 11:08
아이디와 이메일은 각각 유일해야 하기때문에 중복이 되어서는 안됩니다. 그래서 이번시간에는 회원가입에서 아이디와 이메일의 중복체크를 할 수 있도록 해보겠습니다. 먼저 Ajax를 사용하기 위하여 pom.xml에서 라이브러리를 등록해줍니다. pom.xml에 등록해주고 메이븐 업데이트를 해주세요. com.fasterxml.jackson.core jackson-databind 2.13.0 org.codehaus.jackson jackson-mapper-asl 1.9.13 ajax를 사용하려 했는데 slim이 들어간 jquery는 작동이 안된다하여 주석처리를 하고 회원가입 부분에만 따로 bootstrap 적용을 해주었습니다. ajax를 사용하는 jsp에는 이 코드를 사용해주세요. 설정이 완료되었다면 join.jsp..
-
SpringFramework를 이용한 웹사이트 만들기(7)--vo lombok사용하기SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 23. 11:33
회원 가입을 할때 jsp에서 컨트롤러를 통해 데이터 베이스에 값을 집어 넣기 위해 vo 클래스가 필요합니다. 오늘은 그 vo클래스에 대해 알아보고 간편한 lombok사용법을 알아봅시다. 데이터 베이스에 값을 집어넣기 위해 vo라는 클래스를 만들어 줬습니다. vo는 데이터베이스를 만들었을때 썼던 이름을 그대로 가져와서 사용했습니다. varchar,char = string int = int 이렇게 만드시면됩니다. vo를 만들고 Getter와 Setter를 만들어 줍니다. 단축키는 Alt-s-r , Alt-A, Alt-R 을 순서대로 해주시면 완성이됩니다. 다 만드셨으면 toString을 만들어줍니다. 단축키는 Alt-s-s-s, 엔터 두번을 둘러주시면 자동으로 완성이 됩니다. 이렇게가 vo를 만드는 기본 과..
-
SpringFramework를 이용한 웹사이트 만들기(6)--회원가입을 위한 데이터베이스 설정SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 22. 11:05
회원가입을 하기위해 회원 데이터 베이스를 설정해보겠습니다. 먼저 mysql이 다운되어 있다는 가정하에 진행하겠습니다. 연동하는 방법은 밑에 링크를 참조해 주세요. https://seongjae98.tistory.com/26?category=556345 MySQL Connector/J 다운로드후 이클립스와 연동하기 앞에서 Connector/J 를 선택한후 아래그림과 같이, Archives 탭을 클릭한다. - 앞에서 Archives를 선택후 아래와 같은 화면이 나오면 원하는 버전으로 다운로드받을 수 있다. 여기선 5.1.49버전을 다운로드 seongjae98.tistory.com 연동을 해준후 database를 만들어 줍니다. CREATE DATABASE 데이터베이스이름 이렇게 만들어 주시고 저는 airsi..
-
SpringFramework를 이용한 웹사이트 만들기(5)--로그인,회원가입 페이지 만들기SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 20. 21:18
오늘 해볼것은 로그인, 회원가입창 만들기 입니다. 로그인은 부트스트랩의 모달 css를 이용하여 로그인을 할 수 있게 제작하였습니다. 로그인 버튼을 누르면 현재 창에서 모달로 간편하게 로그인창이 작게 나타나게끔 제작 하였습니다. 로그인 창에서 회원가입을 누르게 되면 회원가입창으로 이동하게 됩니다. 컨트롤러에서 회원가입으로 이동하는 코드를 작성 해주신 후 jsp에서 컨트롤러 - jsp로 이동하는 링크를 코딩해주시면 됩니다. 회원가입 ${ctp}는 미리 설정해둔 것으로 맨위에 밑 코드를 삽입하시면 됩니다. 회원가입 창 입니다~~ Daum API를 이용하여 주소를 입력 할 수 있도록 설정 하였습니다. 하는법은 밑에 링크를 확인해주세요. 다음에서 친절히 설명해줍니다. https://postcode.map.daum..
-
SpringFramework를 이용한 웹사이트 만들기(4)--메인페이지 만들기SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 19. 10:14
이번 시간에는 항공 예약사이트 메인 페이지를 만들어 보도록 하겠습니다. 저는 부트스트랩을 사용할 것이기 때문에 include폴더를 만들어서 부트스트랩,w3링크 등을 붙여넣기 해줍니다. 붙여넣은 부트스트랩을 jsp:include를 통해 head에 걸어주고 메인 틀을 잡아줍니다. 그러면 이렇게 메인 틀이 완성이됩니다. 메인 페이지에 넣을 이미지를 resources에 폴더를 만들어 넣어주세요. 그 다음 servlet에 가셔서 location설정을 해주세요 꼭 안하셔도 되는데 설정하면 편해져요!(제기준) w3의 css기능으로 select를 넣어주고 간격 설정해주면 메인 페이지가 완성됩니다!! 완성!~!~!! 자세한 코드내용은 깃 허브를 확인해주세요. 깃 링크 - https://github.com/seongjae..
-
SpringFramework를 이용한 웹사이트 만들기(3)--기본페이지 띄우기SpringFrameWork/Spring 을 활용한 쇼핑몰 만들기 2022. 8. 18. 10:09
웹사이트를 제작하기전 웹 기본페이지를 띄어보도록 합시다. 아파치톰켓이 설정되어있다는 가정하에 진행하겠습니다. package에서 컨트롤 N을 눌러봅니다. 저 뒤에 .을 누르시고 원하시는 패키지를 만들어줍니다 컨트롤N - interface (Service,DAO) 를 만들어 주시고 class - AdminServiceImpl - add - AdminService 선택후 implements를 만들어줍니다. 여기까지가 기본적인 클래스 밑 jsp 만드는 방법이고 이 방식대로 하나하나 늘려갈 생각입니다. 서버를 띄어 주시면 짜잔~~~ 잘 나왔습니다. 404에러가 뜨시면 서버쪽이 문제있으므로 다시 패키지명, 컨트롤러, 폴더위치 확인 바랍니다. 한글처리도 해줍니다!!!