This article covers a Bloomreach Experience Manager version 12. There's an updated version available that covers our most recent release.

The ComponentRenderingURL

When you only want to (re)load a single HstComponent or a subtree of HstComponents, you can use a component rendering url. A component rendering url, just like an HST action url, targets to render a specific HST component, which in turn though can still have descendant component. When you mark an hst component with hst:async = true, the HST will include a component rendering URL instead of rendering actually the component. With this component rendering URL, an asynchronous get can be done, also see Asynchronous HST Components and Containers.

Also, component rendering URLs are used a lot in the channel manager in the CMS to reload only a specific component in the background when you change a property of such a component. 

How to create a HST ComponentRenderingURL?

HST tag:

In your JSP, you can add something like:

 

<hst:componentRenderingURL var="componentRenderingURL"/>
<a href="${componentRenderingURL}" target="_blank">
  Render only this component
</a>

 

If for example your current URL is /news and the tag above is added to the MIDDLE block below,

_____________________________________________
|                  TOP                      | 
|___________________________________________|
|           |                |              |
|           |                |              |
| LEFT      |    MIDDLE      |  RIGHT       |
|           |                |              |
|           |                |              |
|___________|________________|______________|

then, the URL for example looks something like 

 

/news?_hn:type=component-rendering&_hn:ref=r34_r1_r1

 

As you can see, it contains the original URL /news, but has a querystring with parameters _hn:type and _hn:ref that indicate the HST will process the URL as a component rendering URL: The _hn:ref=r34_r1_r1 is the reference for the MIDDLE component, hence, only the MIDDLE component will be rendered in the _blank window when clicking the link. This is very similar to the HST actionURL.

Programmatic 

{
  HstResponse response = ... 
  HstURL componentRenderingURL = response.createComponentRenderingURL();
} 

The code snippet above creates a component rendering URL for the HstComponent that the HstResponse instance belongs to. 

EXPERT 

There is one very subtle property you can set on a hst:component JCR configuration node that influences the rendering of the HST in component rendering mode (thus in the mode where some specific component is rendered). The property is a boolean flag called hst:standalone. When missing, the default value for every hst:component is hst:standalone = true.

By default, all hst:component configuration nodes are standalone, thus also when the hst:standalone property is missing

Whether a hst component is standalone or not means the following: When a component rendering URL is processed by the HST, a specific hst component is targeted. When hst:standalone = true for the targeted component, it means that only the doBeforeRender and renderers (jsp/freemarker) of the targeted HST component (plus its descendants) need to be processed by the HST. When hst:standalone = false , it is assumed that the targeted component might depend on the doBeforeRender of some ancestor or sibling component. In that case, all the doBeforeRender's beloning to the root component id of the matched sitemap item are invoked, but only the renderers of the targeted component and its descendants.

When is a hst component standalone?

When the targeted component and all its descendants are standalone (meaning standalone = true) The descendants need to be standalone as well, because if any descendant is not standalone, their ancestors cannot be standalone either. Note that if the hst:standalone property is nowhere configured, all HST components will be standalone

NOTE : setting hst:standalone = false is strongly discouraged as it introduces a undesirable dependency between your hst components. Also, it will make asynchronous page loading much less efficient
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?