본문 바로가기

개발

(35)
redirect 시 파라미터값 넘기는 방법 컨트롤러에서redirect를 할 때, 파라미터 값을 넘겨야 할때가 있는데 @RequestParam을 사용해주면 된다. 리다이렉트를 하는 부분 addAttribute해준다 @RequestMapping("/test.do") public String insertComment(RedirectAttributes redirectAttributes) { int boardno = 2; redirectAttributes.addAttribute("boardno", boardno); return "redirect:selectPage.do"; } 리다이렉트 받는 부분 RequertParam으로 맵핑함 @RequestMapping("/selectPage.do") public String selectPage(@RequestPar..
Spring에서 MyBatis 연동하기 MyBatis란? 개발 프레임워크로 객체지향 언어인 자바의 관계형 데이터 베이스 프로그래밍을 좀더 쉽게 할수 있게 도와준다 Spring에서 MyBatis를 사용하기 위해서 연동하는 방법을 알아보자! 1. pom.xml에 라이브러리를 넣어준다. Spring은 Maven을 이용하여 라이브러리를 관리하기 때문에 pom.xml에 dependency를 추가해준다 넣을 라이브러리 : mybatis, mybatis-spring, spring-jdbc, commons-dbcp 원하는 버전을 복사해서 붙여넣어주면 된다! 라이브러리 검색은 아래 주소를 통해 할 수 있다. ▼▼▼라이브러리 검색하는 곳 https://mvnrepository.com/ Maven Repository: Search/Browse/Explore Ke..
web.xml에 welcome-file 설정하는 방법 프로젝트를 Run했을 때, 내가 원하는 View(html/jsp)로 바로 이동하려면 web.xml에서 welcome-file을 지정해주면 된다! /WEB-INF/views/board.jsp 경로는 webapp이 기본값이므로 여기부터 경로 지정을 하면 된다 그리고 앞에 '/'를 꼭 붙여주어야 한다.

반응형