I am using the following snippet to inject a title in the base-template:
<#-- Title -->
<!-- get title from document-bean --->
<#if hstRequest.requestContext.contentBean.title??>
<title>${hstRequest.requestContext.contentBean.title}</title>
<!-- get title from servlet-attribute (banner component) --->
<#elseif hstRequest.requestContext.getServletRequest().getAttribute("htmlTitle")??>
<title>${hstRequest.requestContext.getServletRequest().getAttribute("htmlTitle")}</title>
<!--otherwise set a default title -->
<#else>
<title>LIENAS GmbH</title>
</#if>
<!-- for the root-page, because servlet does not work here -->
<#if hstRequest.requestContext.baseURL.pathInfo = "" || hstRequest.requestContext.baseURL.pathInfo = "/">
<title>LIENAS GmbH</title>
</#if>
My questions are:
1.Why can I not access the Servlet-Attribute `htmlTitle on the root-page (I debugged the component- it should be there)
2. In case (1) the #else-Block is not executed (that is why I have the last #if Block
Thx