Create Render URLs Without Namespaced Parameters

By default, Bloomreach Content (HST) generates namespaced query parameters when you use the hst:renderURL tag. This behavior prevents parameter collisions when multiple components use the same parameter names on a single page.

Example: Namespaced Parameters

When you create a render URL with parameters, the resulting URL includes the component namespace as a prefix.

JSP Example

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

Freemarker Example

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

The generated URL will look like:

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

In this example, r1_r2 is the namespace for the component. The parameters page and query are prefixed with this namespace to avoid conflicts.

Parameter Retrieval in HstComponent

When you retrieve parameters in an HstComponent, you must use the correct namespace. For example:

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

The getParameter("page") call returns a value only if the request contains the parameter with the correct namespace prefix. If the component's namespace is r1_r2, then:

  • /some/url?r1_r2:page=2 returns 2
  • /some/url?r1_r34:page=2 returns null

Disable Parameter Namespacing

If you require URLs without namespaced parameters, you can disable this feature. This is useful when you need specific URL formats or when parameter namespacing is not desired.

To disable parameter namespacing, set the following property in your hst-config.properties file:

parameter.namespace.ignored = true

When this property is set to true, the HST does not add namespaces to parameters generated by the <hst:renderURL/> tag. The framework also retrieves parameters from the HstRequest without considering namespaces.

Warning:
Disabling parameter namespacing increases the risk of parameter name collisions. If multiple components on the same page use the same parameter names, their values may conflict. Ensure that parameter names are unique across components when namespacing is disabled.

Share Feedback
Page: /build/web-files-links-urls/create-render-urls-without-namespaced-parameters
Section: Build
Category *
Create render URLs without namespaced parameters | Bloomreach Content Documentation