Spring MessageSource

How to use Spring MessageSource:

org.springframework.context.MessageSource  # interface
org.springframework.context.support.ResourceBundleMessageSource #impl

Add to Maven:



  <bean id="messageSource"
    <property name="basename" value="messages"/>

Add messages.properties to classpath

Use in POJO:

 private MessageSource messageSource;
 messageSource.getMessage(lookup_code, args, Locale.ENGLISH)


Use in JSP:

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<spring:message code="greeting" />

via: http://www.coderanch.com/t/489232/Spring/spring-message-tag-labels-java

Tagged with: , ,
Posted in Spring

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: