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.


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 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.


本产品经 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License 许可  Twitter™ 与 Facebook 中的内容不在 Creative Commons 的条款约束之下。

法律声明   |   在线隐私策略