Reputation: 2847
Using in my jsp like:
<spring:message code="key1"/>
,
I got error:
** Root cause is: No message found under code 'key1' for locale 'zh_CN'. javax.servlet.jsp.JspTagException: No message found under code 'key1' for locale 'zh_CN'. at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184) at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79) at
And the following is my code:
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="com.bk.message.Message" />
<property name="defaultEncoding" value="UTF-8" />
<property name="useCodeAsDefaultMessage" value="false" />
</bean>
here is my properties:
Message_zh_CN.properties under folder src/com/bk/message
key1=This
Upvotes: 1
Views: 5462
Reputation: 11
Hey,it is more useful to put the configuration in applicationContext.xml. And then you can load the properties from classpath,such as
<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>i18n/views</value>
</list>
</property>
</bean>
Now, you can load many properties which are defined by youself.
Upvotes: 1