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

Create render URLs without namespaced parameters

By default, the HST is set up to create namespaced query parameters when using the hst:renderURL tag.

For example when page = 2 and query = hippo, something like this

JSP

<hst:renderURL var="pagelink">
     <hst:param name="page" value="${requestScope.page}" />
     <hst:param name="query" value="${requestScope.query}" />
</hst:renderURL>

Freemarker

<@hst.renderURL var="pagelink">
     <@hst.param name="page" value="${page}" />
     <@hst.param name="query" value="${query}" />
</@hst.renderURL>

results in something like:

/some/url?r1_r2:page=2&r1_r2:query=hippo

This namespacing of parameters is done because one and the same HstComponent class can be used twice on a page, with the same rendering template: The namespacing is there to avoid collisions between parameters of different components. Also note that in a HstComponent, when you have

SomeHstComponent:

@Override
public void doBeforeRender(HstRequest request, HstResponse response)
            throws HstComponentException {
  request.getParameter("page");
}

that the above code will only be able to fetch the parameter page if on the request the page parameter is prefix by the namespace of the HstComponent that calls this doBeforeRender. Thus, if the SomeHstComponent has a namespace equal to > r1_r2 then:

request.getParameter("page");

will return 2 for /some/url?r1_r2:page=2 and it will return null for /some/url?r1_r34:page=2

Turning off this parameter namespacing

If the customer is very specific on URLs and parameters, they might demand that they don't want namespaced parameters. You can achieve that with one single setting in the hst-config.properties. Namely add:

hst-config.properties:

parameter.namespace.ignored = true

This will make the HST to not write namespaced parameters from the <hst:renderURL/> tag, and it will fetch parameters from the HstRequest also without taking namespacing into account. However, be aware:

Watch out for namespace collisions

You have to take care as a developer, that you are not using the same parameter for multiple components on a single page

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?