1. servlet-context.xml 설정
<!-- 리소스 디렉토리 아래의 message.properties를 MessageSource에 포함시킨다. -->
<beans:bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<beans:property name="basename" value="classpath:message/message"/>
<beans:property name="defaultEncoding" value="UTF-8" />
<beans:property name="cacheSeconds" value="60"/>
</beans:bean>
2. message_ko.properties 설정
LABEL.APPNAME = 만세만세
3. jsp 설정
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Insert title here</title>
</head>
<body>
Hello World!!
<spring:eval expression="@configProperties['mysql.username']"> </spring:eval>
<p>LABEL.APPNAME : <spring:message code="LABEL.APPNAME" text="default text" /></p>
</body>
</html>
'개발 > 개발환경설정' 카테고리의 다른 글
Spring 다국어 적용 (0) | 2020.08.11 |
---|---|
Spring property 암호화 (jasypt) (0) | 2020.08.11 |
util:properties 설정 (0) | 2020.08.10 |
Tiles 설정 (0) | 2020.08.10 |
Filter 설정 (0) | 2020.03.18 |