Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 이클립스
- 클래스
- 어노테이션
- 배열
- AWT
- 예외처리
- Eclips
- 전화걸기
- Android
- 오버로딩
- 안드로이드
- 메소드
- Spring
- HTML
- 생성자
- oracle
- JavaScript
- mybatis
- Menu
- 에러페이지
- 기본
- JSP
- OGNL
- 메서드
- 국제화
- paint
- struts2
- Java
- layout
- Graphic
Archives
- Today
- Total
note
Spring 국제화 본문
message/error.properties
login.fail=Member ID {0} is not matching password
message/greeting_en.properties
greeting=Hello!
message/greeting_ko.properties
greeting=안녕하세요!
applicationContext.xml
message.greeting
message.error
Main.java
package madvirus.spring.chap03;
import java.util.Locale;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main {
public static void main(String[] args) {
String[] configLocations = new String[] { "applicationContext.xml" };
ApplicationContext context = new ClassPathXmlApplicationContext(
configLocations);
Locale locale = Locale.getDefault();
String greeting = context.getMessage("greeting",new Object[0],locale);
System.out.println("Default Locale greeting: "+greeting);
}
}
Locale 강제 설정
Main02.java
package madvirus.spring.chap03;
import java.util.Locale;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Main02 {
public static void main(String[] args) {
String[] configLocations = new String[] { "applicationContext.xml" };
ApplicationContext context = new ClassPathXmlApplicationContext(
configLocations);
Locale locale = Locale.ENGLISH;
String greeting = context.getMessage("greeting",new Object[0],locale);
System.out.println("Default Locale greeting: "+greeting);
}
}
'JSP > Spring' 카테고리의 다른 글
Spring @Autowired 어노테이션 (0) | 2012.02.29 |
---|---|
Spring @Required 어노테이션(Annotation) (0) | 2012.02.29 |
Spring 프로퍼티 타입을 이용한 의존 관계 자동 설정 (0) | 2012.02.29 |
Spring 프로퍼티 이름을 이용한 의존 관계 자동 설정 (0) | 2012.02.29 |
Spring Di 심화 학습 (0) | 2012.02.29 |