Question

Can we recover the active profile in tiles.xml?

I need to display an indicator in the title of the active profile.

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>

Was it helpful?

Solution

Why don't you use app.properties as follows?

spring.profiles.active=QA

then in your xml you can use:

<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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top