Category Archives: FrameWork

MiPlatform에서 null 체크시 주의할 점

By | 2월 3, 2012

MiPlatform 에서 어떤 객체가 어떤 속성을 가지고 있는지 체크를 할 때  if( obj.splHorz != null ) { … } 과 같은 코드를 사용하곤 했는데, 이놈이 오류 가능성을 내포하고 있었다. 왜냐하면 MiPlatform에서는 비록 객체 자신이 해당 속성을 갖고 있지 않다고 해도, 부모객체가 해당 속성을 갖고 있으면 자신이 갖고 있는 것으로 간주하기 때문이다. 그래서 일례로, 하위페이지가 split… Read More »

MiPlatform에서 Form onload시 타이머(timer)를 사용하여 인터벌을 주는 방법

By | 2월 3, 2012

1. OnLoadCompleted 계열의 함수의 원하는 위치에서 setTimer() 함수를 호출한다.     form_OnLoadCompleted(){         settimer(1,1000);   //이벤트ID 1번, 1초 후 OnTimer 이벤트 발생시킴     } 2. Form의 OnTimer 이벤트에 바인딩할 함수를 만들고, 바인딩한다     killtimer() 함수를 사용하여 한 번만 실행하고 종료시킨다.     function commForm_OnTimer(obj,nEventID){         commForm_setResize(this);  //OnLoadCompleted 얼마 후 한… Read More »

[펌글] 스프링의 StringUtils 메서드 정리

By | 1월 20, 2012

– 출처 : http://julingks.tistory.com/38 – 스프링에서 StringUtils 살펴보기 Util 라이브러리를 120% 활용하기 위해서는 어떤 메소드를 제공하는가를 빨리 파악해야 한다. 그래야 불필요 없는 중복 코드를 생성하지 않고, 자주 쓰는 간단한 함수를 작성하는데 드는 시간을 절약할 수 있다. org.springframework.util 패키지에 있는 StringUtils 클래스를 살펴보자. API 문서 http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/util/StringUtils.html 스트링 관련 잡단한 메서드들이 있다. 스프링 프레임웍 내부에서 사용하기 위해서 만들었는 데 Jakarta’s Commons Lang의 스트링 유틸리티들의… Read More »

스프링(spring) 어플리케이션(application) 시작시 원하는 메서드가 실행되도록 하는 방법

By | 10월 25, 2011

1. ApplicationListener 구현 import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; public class Test implements ApplicationListener{ //변수와 setter를 선언하여 bean xml 로부터 값을 넘겨받을 수 있다. String var1; public void setVar1(String var1) { this.var1 = var1; } //스프링 시스템 기동시 수행 public void onApplicationEvent(ApplicationEvent applicationevent) { System.out.println(“### Test.onApplicationEvent() > var1 : “+ var1 +”###”); } } * implements 할… Read More »

Spring에서 트랜젝션 내에 별도의 트랜젝션을 가져가는 방법 (Spring 2.5 / 어노테이션 기반 트랜젝션)

By | 6월 22, 2011

어노테이션 기반 트랜젝션 (예:<tx:annotation-driven/>) 에서 어떤 클래스에 @Transactional 이 선언되어 있고 이 클래스는 다음과 같은 메서드를 가진다고 할 때 메서드A(){          for(int i=0; i<10; i++){         메서드B();     }  } 메서드A()는 스프링의 프록시로 감싸져 있기 때문에 Exception 발생시 롤백이 가능하지만, 그 안에 있는 메서드B()는 현재 개별적인 트랜젝션처리(각 루프별 독립적 롤백)가 불가능한 상태이다. 이 경우에는 다음과 같이… Read More »

ibatis 에서 쿼리 문장 내에 #이 포함되어 있을 경우 escape 방법

By | 6월 21, 2011

select ‘#ABC’ from dual  위와 같은 SQL문을 ibatis로 실행하려 할 경우, ibatis는 #이후를 바인딩 변수로 인식하려 하기 때문에 오류를 발생시키게 된다. 이 경우는 #앞에 #을 한 번 더 붙여 주면 첫 번째 #은 escape character로만 작용하고 이후 #을 일반 문자열로 인식하게 된다. select ‘##ABC’ from dual 

[펌글] javax.servlet.ServletException: No form found under ‘UserLoginForm’ in locale ‘en_US’ … 류의 에러

By | 2월 11, 2010

– 출처 : http://vchaithanya.wordpress.com/2007/12/22/javaxservletservletexception-no-form-found-under-userloginform-in-locale-en_us/ – This is the exception thrown when i try to perform client-side validations using dynavalidatorform in struts: solution: check for the form name in the following files, this is where the problem occurs most of the times. Even is we add ‘/’ to the formname somewhere it throws the above exception. 1)… Read More »

[펌글] STRUTS – SPRING 연계 방법

By | 8월 21, 2009

[출처] STRUTS – SPRING 연계|작성자 돌맹이 1. 코드로 서비스를 직접 받아 오기 아주 단순한 방법이다. ApplicationContext를 가져 와서 bean을 직접 찾아 온다. 스트럿츠의 action에서 직접 코딩해 준다. 1) Action 클래스는 org.springframework.web.struts.ActionSupport 를 상속해야 한다. 2) 직접 코딩      ApplicationContext ctx = getWebApplicationContext();      TreeService treeService = (TreeService)ctx.getBean(“treeService”); 특징: 스프링과 스트럿츠가 완전 따로 논다. 장점: 설정이… Read More »

Ibatis에서 select한 CLOB 데이타를 String으로 얻어오기

By | 6월 23, 2009

– 출처 : http://anarchi.tistory.com/34 – 위 글의 요점은 다음과 같다. (CLOB이 select 쿼리에 포함되어 있다는 전제하에) 1. <select id=”selectXXXX” resultClass=”java.util.HashMap”>  처럼     바로 HashMap으로 들어가지 말고, 별도의 resultMap을 정의할 것     => <select id=”selectXXXX” resultMap=”xxxxResultMap”> 2. resultMap 정의시 쿼리 순서와 resultMap 정의 순서가 동일해야 함 3. resultMap이나 쿼리나 CLOB 항목은 제일 마지막에 두어야 함. 4. resultMap에서 CLOB에 관한… Read More »

valang 에서 정규표현식(regex) 사용하는 예제

By | 3월 14, 2009

<bean id=”theValidator” class=”org.springmodules.validation.valang.ValangValidator”>   <property name=”valang”>      <value>       <![CDATA[        { numfield : ? NOT NULL and matches(‘정규식’,?) is true : ‘numfield  no match’ : ‘numfield.nomatch’ }       ]]>     </value>   </property> </bean> 이거 알아내느라고 힘들었다능.. ㅠ_ㅠ.. matches 말고 match도 쓰는 것 같은데 차이를 모르겠다… – 출처 : 구글에게구걸 –

resultMap의 상속(extends) 이용하기

By | 3월 2, 2009

– 출처 : http://blog.daum.net/uttiboy/13497132 – 예제) 내용을 포함하지 않은 message 객체     <resultMap id=”message-result” class=”message”>         <result property=”messageId” column=”MESSAGE_ID”/>         <result property=”boardId” column=”BOARD_ID” />         <result property=”title” column=”TITLE” />         ….     </resultMap>        내용을 포함한 message 객체     <resultMap id=”message-contents-result” extends=”message-result” class=”message”>         <result property=”contents” column=”CONTENTS” javaType=”string” jdbcType=”CLOB” />     </resultMap>

[Ibatis] Ibatis에서 아무런 이유 없이 select 결과가 나오지 않을 때

By | 2월 27, 2009

Ibatis 로 select 작업을 하던 도중에, 특정한 키값으로 검색을 하니 ResultSet을 전혀 리턴해주지 못하고 로그도 멈추는 경우가 있었다. 로그를 긁어다가 토드에 붙여서 실행을 하면, 분명히 select 를 해 오는데, 똑같은 쿼리를 Ibatis에서 돌리면 전혀 결과값을 못얻어오는 것이었다. 나중에 알고 보니, 그 키값이 있는 칼럼이 DB에는 char(18) 로 되어 있었는데, 던졌던 테스트 데이터는 14자리여서 그런 오류를 냈던 것이었다.… Read More »