How to localize page title with Spring and Tiles2?
Did you ever tried to put the message key in you tiles variable and use it as key for the spring message tag.
Something like that:
<definition name="welcome.page" extends="main.page"> <put-attribute name="titleKey" value="page.main.title"/> <put-attribute name="body" value="/pages/welcome.jsp"/></definition>
jsp:
<set var"titleKey"><tiles:getAsString name="titleKey"/></set><title><spring:message code=${titleKey} /></title>
The previous answer contains several little mistakes
tiles.xml
<definition name="main" template="/WEB-INF/jsp/template.jsp"> <put-attribute name="titleKey" value="main.title" /> <put-attribute name="body" value="/WEB-INF/jsp/main.jsp" /></definition>
jsp (/WEB-INF/jsp/template.jsp)
<c:set var="titleKey"><tiles:getAsString name="titleKey"/></c:set><title><spring:message code="${titleKey}"></spring:message> </title>