【问题标题】:Get spring.profiles.active in Tiles.xml在 Tiles.xml 中获取 spring.profiles.active
【发布时间】:2013-05-03 14:48:31
【问题描述】:

我们可以恢复tiles.xml 中的活动配置文件吗?

我需要在活动配置文件的标题中显示一个指示符。

web.xml

<context-param>
    <param-name>spring.profiles.active</param-name>
    <param-value>QA</param-value>
</context-param>

Tiles.xml

<definition name="base.layout" template="/WEB-INF/views/layout/layout.jsp">
    <put-attribute name="title" value="My title - GET PROFILE ACTIVE HERE" />
    <put-attribute name="header" value="/WEB-INF/views/layout/header.jsp" />
    <put-attribute name="contentLayout" value="" />
    <put-attribute name="footer" value="/WEB-INF/views/layout/footer.jsp" />
</definition>

【问题讨论】:

    标签: spring-mvc tiles tiles2 apache-tiles


    【解决方案1】:

    为什么不按如下方式使用 app.properties?

    spring.profiles.active=QA
    

    然后在你的xml中你可以使用:

    <util:properties id="app.properties" location="classpath:application.properties"/>
    
    <definition name="base.layout" template="/WEB-INF/views/layout/layout.jsp">
        <put-attribute name="title" value="${spring.profiles.active}"/>
     ...
    </definition>
    

    【讨论】:

      猜你喜欢
      • 2021-03-15
      • 2019-06-09
      • 1970-01-01
      • 2018-09-04
      • 2013-02-20
      • 1970-01-01
      • 1970-01-01
      • 2022-07-13
      • 1970-01-01
      相关资源
      最近更新 更多