原文地址:http://www.cnblogs.com/liukemng/p/3750117.html
用Spring做國際化時經常會報:
org.springframework.context.NoS hMessageException: No message found under code 'title' for locale 'zh_CN'. 這樣的錯誤。請注意以下幾點:
①新建資源文件時,盡量右擊項目新建文件,來增加.
② 屬性文件名的寫法:
messages_zh_CN.properties (中文) messages_en_US.properties (英文)
③ 配置messageSource這個bean(注意:一定是messageSource不是messageResource ,這是Spring規定的)例如:
<beanid="messageSource"class="org.springframework.context.support.ResourceBundleMessageSource"> <propertyname="basename">
<val>messages</val>
</property>
</bean>
posted on 2015-03-26 16:08
SIMONE 閱讀(592)
評論(0) 編輯 收藏 所屬分類:
JAVA