0

I would like to have a external property (which has label name & value pairs) for each jsp pages in my web application.

I've done in this way like simply reading property file in a Map and placing in jsp using expression language.

Is there any other methodology to handle these in Java/Spring?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Surendheran
  • 187
  • 1
  • 18

2 Answers2

0

You can have these as message properties

http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/

This also explains this in detail - http://www.journaldev.com/2610/spring-mvc-internationalization-i18n-and-localization-l10n-example

If you need these to be by locale, you can use localechangeInterceptor also.

You can PropertyPlaceholderConfigurer for external properties (eg the systemPropertiesMode property)

http://www.summa-tech.com/blog/2009/04/20/6-tips-for-managing-property-files-with-spring

There are also more ways to do this like http://howtodoinjava.com/2015/01/27/how-to-load-external-resources-files-into-spring-context/

<bean id="messageSource"
class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basename">
        <value>locale\customer\messages</value>
    </property>
</bean>

spring mvc and ReloadableResourceBundleMessageSource

Community
  • 1
  • 1
Paul John
  • 1,626
  • 1
  • 13
  • 15
0

Yes there is another way to show the labels in spring and this one is the best practice code.

enter link description here This will explain you how to use <spring:message code="label.viewUser" /> in your project.