[Hippo-cms7-user] Head contributions in sub-component

Ard Schrijvers a.schrijvers at onehippo.com
Thu Oct 6 09:11:52 CEST 2011

On Wed, Oct 5, 2011 at 5:55 PM, Woonsan Ko <w.ko at onehippo.com> wrote:
> On 10/05/2011 11:48 AM, marnixkok wrote:
>> Hi,
>> Oh wow, the tags I was using have been deprecated, learn something new every
>> day!
>> Unfortunately the example you showed doesn't work. Scrolling through the TLD
>> for the taglibrary to discover any tags I had been missing out on, I
>> discovered the following as the description of <hst:writeHeadContributions/>
>> "All the HEAD elements contributed by each HstComponent can be accessed only
>> by
>> the root HstComponent. The root HstComponent will be responsible for
>> rendering all the
>> contributed HEAD elements. By inserting this tag, the root HstComponent can
>> render all
>> the contributed HEAD elements."
> Right. The description is correct, indeed. The <hst:headContributions/>
> tag is meaningful only in the root component because it's designed to

Indeed. If you want to 'share' contributions from parent to descendant
components, you can use HstRequest#getRequestContext#setAttribute and
getAttribute : The requestContext is shared between components.

Pls realize you are imposing a dependency now between components.
Something you might want to avoid as much as possible

Regards Ard

> contribute head elements in the page and we have thought it would be
> okay with this constraint.
> Internally, when you add a head element, it's added up into the root
> component's response state only. It was a designed optimization.

More information about the Hippo-cms7-user mailing list