Spring
-
회원가입, 로그인, 게시판 백엔드 실습( 게시판 디테일 )Spring 2023. 4. 5. 15:37
게시판 리스트에서 게시글의 제목을 클릭하면 디테일로 이동할 수 있게 만들었다. : 디테일로 이동하면 하나의 게시글에 대한 상세 정보를 볼 수 있고, 이를 수정 / 삭제할 수 있는 기능을 넣을 것이다. 1. Controller @Controller public class BoardController { @Autowired BoardService bs; // 게시글 Detail @RequestMapping(value = "/board/detail", method = RequestMethod.GET) public String detail (BoardVO board, Model model) { model.addAttribute("detail", bs.detail(board)); return "board/deta..
-
회원가입, 로그인, 게시판 백엔드 실습( 게시판 글쓰기 )Spring 2023. 4. 5. 15:35
게시판 글쓰기 : 게시글을 데이터베이스에 추가할 수 있는 기능을 만들 것이다. 이 때 로그인한 아이디에 대한 정보를 게시글에 남긴다. 1. Controller // 게시판 글쓰기 데이터 저장 @RequestMapping(value="/write", method = RequestMethod.POST) public String writePost(BoardVO board) { System.out.println(board); bs.write(board); return "redirect:/board/list"; } - BoardVO 객체에 게시판에 대한 정보를 담아서 데이터베이스에 저장할 것이다. public class BoardVO { private int board_no; private String title..
-
회원가입, 로그인, 게시판 백엔드 실습( 게시판 리스트 )Spring 2023. 4. 5. 15:23
데이터 베이스에 저장되어있는 데이터를 게시판에 나타내자. 1. Controller // 게시판 메인 @RequestMapping(value="/board/list", method = RequestMethod.GET) public String list (Model model, CriteriaVO cri) { model.addAttribute("list", bs.list(cri)); int total=bs.total(cri); model.addAttribute("paging", new PageVO(cri, total)); return "board/list"; } - bs.list() 함수의 결과로 게시글에 대한 정보를 ArrayList에 담아오고 - bs.total() 의 결과로 게시글의 총 량을 int 타..
-
회원가입, 로그인, 게시판 백엔드 실습( login 기능 구현 )Spring 2023. 4. 4. 15:49
Login 기능 구현하기 : 회원가입 기능을 이용해서, 데이터베이스에 유저 정보를 저장할 수 있게 만들었다. 이제는 유저가 로그인하기 위해 입력하는 데이터가 회원 데이터베이스 내부에 존재하는지 확인하고 데이터가 내부에 존재한다면 session에 login 기록을 저장하고 존재하지 않는다면, login 화면에 머무르게 만들 것이다. 1 . Login.jsp 구성하기 - logind은 post 방식으로 id와 password에 대한 정보를 받을 것이다. input 태그 내부에 required="" 는 해당 칸이 비었을 경우 submit 기능을 막아주는 것이 원래의 기능이지만, 여기서는 css가 정상적으로 작동하려면 해당 attribute가 꼭 필요하다. 2. Contoller 작성 - Login.jsp의 f..
-
회원가입, 로그인, 게시판 백엔드 실습( login 화면 )Spring 2023. 4. 4. 15:26
로그인화면 구성하기 - 우선은 Spring을 활용해서, 회원가입을 하면 유저의 데이터를 데이터베이스에 저장하고 login 할 때 데이터베이스에 일치하는 데이터가 있다면, session에 로그인 정보를 저장하고 일치하는 데이터가 없다면, 다시 login화면으로 돌아오는 기능을 구현할 것이다. - 유효성 검사는 차후에 진행할 예정 ** 로그인 기능은 MemberController -> LoginService -> LoginServiceImpl -> LoginMapper -> LoginMapper.xml 과정으로 데이터베이스와 연동할 것이다. 1) 로그인 화면에 template 구성하기 - codePen에서 깔끔한 로그인 css를 가져왔고, 회원가입 페이지는 로그인 페이지의 양식을 변경했다. 2) 회원가입 기..
-
회원가입, 로그인, 게시판 백엔드 실습( main 화면 )Spring 2023. 3. 31. 16:46
Spring 에서 회원가입 , 로그인 , 게시판 백엔드 실습을 진행해보자. : html 템플릿 등을 활용해서 브라우저에 나타나는 요소들을 꾸며주고, mySql을 데이터베이스로 연결해서 백엔드 작업을 진행해보자. 목표 - Spring을 활용해서 MVC 구조로 작업을 처리하는 웹 페이지를 만들어보자. - jsp 파일에 html 템플릿을 적용 , css, javascript 파일을 연결 - tomcat 8.5 버전으로 local 서버를 구축하고 페이지를 이동할 수 있게 만든다. - spring에 연동되 있는 java 프로그램을 이용해 Controller, Mapper, Model, Service 클래스들을 생성하고 데이터베이스와 연동할 수 있게 만든다. - mySQL 을 활용하여 웹 페이지에서 입력한 데이터를..
-
List : Detail , Modify, DeleteSpring 2023. 3. 30. 10:12
Detail 1. jsp 작성 ArrayList로 받아와서 만들었던 List.jsp이다. 여기서, 제목을 클릭하면 해당 정보를 상세하게 볼 수 있게 만들 것이다. ${list.id} 제목에 a태그를 주고, href에 전달하고자 하는 파라미터( id ) 를 ? 뒤쪽에 넣었다. 2.Controller - MemberController에는 LoginVO 타입의 객체와 , Select 한 값을 받아올 Model 객체를 매개변수로 선언했다. Select로 특정 id 값을 가진 데이터들을 가지고 올 것이기 때문에, model.addAttribute( "memDetail", ls.memDetail(member) ); ls.memDetail(member) 로부터 받아온 return 값을 memDetail에 저장하도록 ..