본문 바로가기

프로그램312

response.sendRedirect() 전송되는 페이지의 http 헤더에 redirect 정보를 담아서 보내면 브라우저가 헤더 정보를 분석해서 해당 URL로 리다이렉트 시킨다. 코드 상에서 sendRedirect() 를 사요한 경우, 그 이후에 나오는 코드에서는 헤더정보, 쿠키, 세션을 조작할 수 없다. Cannot create a session after the response has been committed 에러 발생 Example response.sendRedirect(“/test/test.jsp”); … 2014. 1. 31.
톰켓에서 OracleCallableStatement 캐스팅 사용시 ClassCastException 에러 해결 방법 Oracle 스토어드 프로시져에서 Cursor(ResultSet)을 가져오는 경우에, 톰켓에서 컨넥션풀을 이용해서 컨넥션을 받아올 때 OracleCallableStatement를 캐스팅 해서 사용하면 ClassCastException 을 발생시킨다. 이때는 표준 API (java.sql) 를 이용한다. 1) OracleCallableStatement 캐스팅 사용 cs.execute(); OracleCallableStatement ocstmt = (OracleCallableStatement)cs; ResultSet rs = ocstmt.getCursor(1); 2) java.sql 만 사용 cs.execute(); ResultSet rs = (ResultSet)cs.getObject(1); 2014. 1. 30.
java.lang.Error: Unresolved compilation problem java.lang.Error: Unresolved compilation problem 에러가 발생하는 경우, 이클립스 IDE를 사용하는 경우에는 프로젝트를 Project>Clean 를 실행한다. 배포중인 상태에서는 서버를 celan 시킨다. 2014. 1. 29.
[Spring] cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:interceptors'. cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:interceptors' 오류는 spring-servlet.xml 파일 안에서 태그를 사용하는 경우에 발생한다. spring-servlet.xml 파일 안에서 태그를 사용하기 위해서는 태그에 다음 값들을 추가해 주어야 한다. 2014. 1. 29.
[Spring] The type javax.servlet.http.HttpServletRequest cannot be resolved. It is indirectly referenced from required .class files Spring Interceptor 관련 개발을 하는 과정에서 public class LoginCheckInterceptor implements HandlerInterceptor{ @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception{ return true; } @Override public void afterCompletion(HttpServletRequest arg0, HttpServletResponse response, Object handler, Exception exp) throws Exception { } @Override p.. 2014. 1. 29.
[JSTL] <c:choose> 여러개의 조건을 제시하고 해당 조건에 맞는 문장을 수행한다. 다중 if문 또는 switch문과 동일한 동작을한다. //조건문1이 참임 조건인 경우 수행되는 문장 //조건문1이 참임 조건인 경우 수행되는 문장 //조건문1이 참임 조건인 경우 수행되는 문장 //위 조건에 해당하지 않는 경우 수행되는 문장 조건문 : true or false 를 판단할 수 있는 조건문이 들어간다. 연산자 : ==, !=, >, >=, 2014. 1. 28.
배열을 복사하는 방법 1) clone() 메소드를 사용한 배열 복사 int[] a = {1, 2, 3, 4}; int[] b = (int[])a.clone(); 2) arraycopy() 메소드를 사용한 배열 복사 int[] a = {1, 2, 3, 4}; int[] b = new int[a.length]; System.arraycopy(a, 0, b, 0, a.length); 3) 반복문을 사용한 배열 복사 int[] a = {1, 2, 3, 4}; int[] b = new int[a.length]; for(int i = 0; i < a.length; i++){ b[i] = a[i]; } * arraycopy() 메소드를 이용하는 방법이 성능이 가장 좋다. 2014. 1. 27.