No component context in request, template not rendered

Issue

You have a component where you declared selectors.

  • There is no component context in the request.
  • The component is rendered, but the template is not.

Solution

JSP A is defined as component script (you can only define one) in your component definition. You then added a glob for JSP B to the component definition. When component X is included in the template (either in the paragraph system or with tag), the component includer is only aware of JSP A as the component script. That'€™s the JSP that gets included in the output of the template JSP.

The glob pattern from the component definition (for jsp B) is added to the template definition. It behaves the same way as globs added directly to the template definition. This behavior is expected; it's useful if your component has to generate a request to another resource as with images or Ajax requests. In such cases, it's necessary to know what the glob pattern is when you define the component.

To achieve the expected behavior, it's necessary that your component gets the selector from the request, and bases it on that render content in a different way. Do not add a glob to the component definition. If you want to break it down into different JSPs, you can use of tag and insert a different JSP-based on the selector.

The com.day.cq.delivery. DeliveryHttpServletRequest interface defines public String getSelectorString() and public String getSelectors() methods for working with selectors. The JSP request object can be cast directly to this interface in CQ.

Attached below is a simple example. For simplicity, this example does not use a paragraph system.

Atsisiųsti

 Adobe

Gaukite pagalbą greičiau ir lengviau

Naujas vartotojas?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Spalio 14–16 d. Miami Beach ir internetu

Adobe MAX 2024

Adobe MAX

The Creativity Conference

Spalio 14–16 d. Miami Beach ir internetu