2007/09/11 09:51
import java.util.Locale;
import java.util.ResourceBundel;
위와 같이 먼저 사용하는 것들을 import.import java.util.ResourceBundel;
ResourceBundel rb = ResourceBundel.getBundel("파일명", Locale.getDefault());
위와 같이 resourcebundel을 선언해 준다.파일명은 classes 폴더를 기준으로 작성하면 된다.
예를들어 classes 디렉토리 아래 lang이란 폴더에 lang.properties라는 파일로 국제화를 제공한다면,
/lang/lang으로 적어주면 된다.
classes 디렉토리 상위에도 작성 가능한지 여부는 모르겠다.
MyException(new String(rb.getString("board.name").getBytes("8859_1"), "KSC5601"));
이런식으로 처리하면 한글 출력도 문제 없다.내 환경 : properties 파일은 unix 파일로 되어 있고 서비스는 utf-8을 제공한다.
'프로그래밍 > 웹 프로그래밍' 카테고리의 다른 글
| [jQuery] XML 처리시 IE에서 find 함수가 동작하지 않는 경우 (4) | 2009/11/25 |
|---|---|
| [javascript] innerHTML 오류(IE 계열만) (0) | 2007/11/19 |
| [struts] action에서 국제화 (0) | 2007/09/11 |
| [iBATIS] The column index is out of range: 1, number of columns: 0 (0) | 2007/09/10 |
| struts + iBATIS + DBCP 사용하기 (1) | 2007/08/27 |
TAG ResourceBundle,
struts,
국제화
댓글을 달아 주세요