본문 바로가기

Spring28

[Spring] Spring Controller 파라미터 타입 (1) Spring Controller 파라미터 타입 (1) Posted on 2017년 7월 31일 출처 : http://wonwoo.ml/index.php/post/1834 오늘 소개할 내용은 Spring의 Controller에서 사용할 수 있는 파라미터 타입들을 알아보도록 하자. . Spring에서 Controller로 받을 수 있는 파라미터들이 다양한 타입들이 존재하는데 이는 Object 혹은 어노테이션등으로 선언하면 자동으로 Spring이 그에 맞게 변환해주고 있다. 다 알아볼 수 는 없겠지만 자주 사용하는 부분 위주로 최대한 많이 살펴보도록 하자.필자의 경우에는 Controller에서 servlet API를 거의 사용하지 않는다. 예를들어 HttpServletRequest, HttpServletRes.. 2019. 2. 8.
[Spring] Datatables 의 sorting 및 paging 전송 시 파리미터 매핑 오류 Datatables의 serverSide 가 true 일 경우 paging 및 sorting 시 서버 호출이 일어난다.하지만 넘어가는 파라미터가 제대로 spring mvc 에서 매핑을 해주지 못하는 현상이 발생했다. 해결책은 jquery.spring-friendly.min.js 를 추가하는 것이다. 기존 파라미터의 경우 columns[0][data] 으로 넘어가는 것을 columns[0].data 으로 변환해 주는 역활을 한다.배열인데 인덱스가 아닌 문자열이 들어가서 오류가 발생하는 듯하다. 참조https://stackoverrun.com/ko/q/6494522 내 QueryString 매개 변수를 Spring JavaBean Command 객체에 매핑하려고하는데 실제로 빠져 있습니다. 지금까지 내 질문.. 2019. 2. 8.
[Spring] HTTP PUT 전송시 Command Object 바인딩(binding) 실패 (on RESTful) J2EE Servlet 명세에서 인코딩된(content type : application/x-www-form-urlencoded) HTTP PUT 메소드는 지원하지 않기 때문에 폼에 값을 담은 후 PUT으로 서버에 전송할 경우 Command Object 바인딩이 자동으로 되지 않는다. 해결책은 아래와 같다. 출처 : http://static.springsource.org/spring/docs/current/spring-framework-reference/html/mvc.html 16.3.3.11 Working with "application/x-www-form-urlencoded" data The previous sections covered use of @ModelAttribute to support .. 2019. 2. 8.
[Spring] Spring MVC + handlebars + Helper 추가 Spring에서 Handlebars를 쓴다면? 1. 의존성 설정Maven com.github.jknack handlebars-springmvc ${handlebars-version}https://github.com/jknack/handlebars.java/tree/master/handlebars-springmvc 2. View Resolver 설정xml base java configration@Beanpublic HandlebarsViewResolver handlebarsViewResolver() { HandlebarsViewResolver viewResolver = new HandlebarsViewResolver(); viewResolver.setOrder(1); viewResolver.setPrefi.. 2019. 2. 8.