본문 바로가기

전체 글

*2 절대 경로 /var/lib/tomcat8/webapps/bookPage/pds/productImage (리눅스기준) String path = application.getRealPath("fileFolder"); String path = request.getSession().getServletContext().getRealPath("fileFolder"); java 에서 경로 구분자 표시 알아서 자동으로 인식하는 방법 윈도우 예) c:\temp\... 리눅스 예) /home/yangyag/.. 이렇게 윈도우 환경과 리눅스(유닉스) 환경에서 사용하는 경로의 구분자 값이 다르다. 보통 개발은 윈도우 환경에서 하고 실제 운영은 리눅스(유닉스) 환경에서 하는 경우가 많아 소스 상에서 반영시에는 경로를 바꿔주는 불.. 더보기
Arrays.sort() Arrays.sort() - 자바 배열 정렬 함수 public static void main(String[] args) { int numSort[] = {37,27,40,30,28,19}; Arrays.sort(numSort); for(int i=0; i 더보기
@RequestParam란? - parameter를 쉽게 컨트롤하기 private ModelAndView param_TEST(@RequestParam("test") int num, @RequestParam("test2") String str)) { // 위처럼 하나 이상의 타입을 적용할 수 있다 //RequestParam은 하나 이상 파라미터에서 사용 가능하다 } 하지만 위처럼 사용하게 된다면 만약에 넘어오는 requestParam중 @RequestParam 지정한 키 값이 존재하지 않다면 BadReqeust로 http4** 에러가 발생 이를 방지하기 위하여 즉, 파라미터가 존재하지 않는 경우를 대비해 DefaultValue를 지정할 수 있다 private ModelAndView param_TEST(@RequestParam(value="test", required=fal.. 더보기
3차 프로젝트 개념정리 [2019-11-20~2019-12-20] HashMap 개념 HashMap은 1차원적인 배열을 가지는 List, Set과는 달리 2차원 배열의 형태를 가져 키 값으로 데이터에 접근한다. key와 value를 쌍으로 저장하는 자료구조로 다른 언어에서는 Dictionary 라고 하기도 한다. return Type Method and Description boolean containsKey(Object key) Returns true if this map contains a mapping for the specified key. boolean containsValue(Object value) Returns true if this map maps one or more keys to the specified value. Set keySet() Retur.. 더보기
org.apache.ibatis.reflection.ReflectionException cmd창에서 insert시켰는데 STS에서 계속 select해오는거 값 못받아와서 의아해하다가....... commit안시킨거였음..............5시간 넘게 걸렸는데.. 나는 커밋 바보가 틀림 없다 심각: Servlet.service() for servlet [appServlet] in context with path [/hotel] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for prope.. 더보기
MyBatis를 이용한 게시판 만들기 1탄. JDBC - SPRING DAO로 게시판 만들기 (spring dao) 2탄. JDBC - MyBatis로 게시판 만들기 (spring + mybatis) (1탄 Spring DAO로 게시판 만든 프로젝트 그대로 copy해와서 사용) 프로젝트 복사해와서 새 프로젝트 작업 시 체크 사항 - tomcat add and remove - app-context.xml에 base-package 명 바꿔주기 - 프로젝트 우클릭 > properties > web project settings 바꿔주기 프로젝트명: SpringwebMybatis / 패키지명: com.jdbc.springweb 1. pom.xml 추가 org.mybatis mybatis 3.4.6 org.mybatis mybatis-spring 1.. 더보기
Spring DAO 를 이용한 게시판 만들기 1탄. JDBC - SPRING DAO로 게시판 만들기 (spring dao) 2탄. JDBC - MyBatis로 게시판 만들기 (spring + mybatis) 프로젝트 생성 - 프로젝트명: Springweb / 패키지명: com.jdbc.springweb 기존에 만들어지는 Homecontroller, home.jsp 삭제하고 시작하기 (ServletBoard.zip 참고) 이전에 Servlet으로 만들었던 게시판 (_ok.jsp가 없는 구조) 을 가지고와서 Spring DAO로 게시판을 만드는 버전을 만들 것이다. *회사에서는 com.board 폴더에 한꺼번에 넣지 않고 dao ,dto ,servlet 만 따로 모아두는 패키지를 만든다. ServletBoard.zip 에서 가져올 소스파일 간단하게 정.. 더보기
코드업 1714. 숫자 거꾸로 출력하기 https://codeup.kr/ 1714 : 숫자 거꾸로 출력하기 1) 일단 String값을 입력받는다 2) 입력받은 String값을 split메소드를 이용하여 array_word 배열에 담는다 3) 그 배열의 길이만큼 끝에서부터 하나씩 출력한다 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String word; String[] array_word; int i; word = sc.next(); array_word = word.split(""); // 1234 담긴 상태 int len = array_word.length; //he.. 더보기