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 anHST action url, targets to render a specificHST component, which in turn though can still have descendant component. When you mark an hst component withhst: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 seeAsynchronous HST Components and Containers.
Also, component rendering URLs are used a lot in theExperience 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}"> Render only this component</a>
If for example your current URL is/news and the tag above is added to theMIDDLE 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 theMIDDLE component, hence, only theMIDDLE component will be rendered in the_blank window when clicking the link. This is very similar to the HSTactionURL.
Programmatic
{ HstResponse response = ... HstURL componentRenderingURL = response.createComponentRenderingURL();} The code snippet above creates a component rendering URL for theHstComponent that theHstResponse instance belongs to.
EXPERT
There is one very subtle property you can set on ahst:component JCR configuration node that influences the rendering of the HST incomponent rendering mode (thus in the mode where some specific component is rendered). The property is a boolean flag calledhst:standalone. When missing, the default value for everyhst:component ishst:standalone = true.
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. Whenhst:standalone = true for the targeted component, it means that only thedoBeforeRender and renderers (jsp/freemarker) of the targeted HST component (plus its descendants) need to be processed by the HST. Whenhst:standalone = false , it is assumed that the targeted component might depend on thedoBeforeRender of some ancestor or sibling component. In that case, all thedoBeforeRender'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 (meaningstandalone = 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 thehst:standalone property is nowhere configured,all HST components will be standalone