弹簧前端标签配置

时间:2015-03-12 13:37:20

标签: java spring java-ee jstl

我希望在我的网络应用程序中为每个jsp页面设置一个external property(具有标签名称和值对)。

我已经用这种方式完成了,就像在地图中读取属性文件并使用expression language放入jsp一样。

在Java / Spring中还有其他方法可以处理这些吗?

2 个答案:

答案 0 :(得分:0)

您可以将这些作为消息属性

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

这也详细解释了这一点 - http://www.journaldev.com/2610/spring-mvc-internationalization-i18n-and-localization-l10n-example

如果你需要这些语言环境,你也可以使用localechangeInterceptor。

PropertyPlaceholderConfigurer可以用于外部属性(例如systemPropertiesMode属性)

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

还有更多方法可以执行此操作,例如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

答案 1 :(得分:0)

是的,还有另一种方法可以在春季展示标签,这是最佳实践代码。

enter link description here这将向您解释如何在项目中使用<spring:message code="label.viewUser" />