Spring 2.0
request로 부터 넘어온 파라미터의 형변환에 유용한 ServletRequestUtils 클래스,
int nowPage = 1;
if (request.getParameter("page") != null || !request.getParameter("page").equals("")){
nowPage = Integer.parseInt(request.getParameter("page"));
}
위 코드를 아래와 같이 쓸 수 있다.
int nowPage = ServletRequestUtils.getIntParameter(request, "page", 1);
boolean, float, double, int, long, String 타입으로 받아 올 수 있으며 이 타입들의 배열([]) 타입으로도 바로 바인딩해서 넘겨 받을 수 있습니다.
source : http://whiteship.tistory.com/1005'Application Programing > java/jsp' 카테고리의 다른 글
| JSTL <functions> (0) | 2011/10/10 |
|---|---|
| Spring - ServletRequestUtils (0) | 2011/10/10 |
| Spring - view를 결정하기 (1) | 2011/04/22 |
| java - ThreadLocal 클래스 (2) | 2011/04/12 |
Recent Comments