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.

다운로드

이 작업에는 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License의 라이센스가 부여되었습니다.  Twitter™ 및 Facebook 게시물은 Creative Commons 약관을 적용받지 않습니다.

법적 고지 사항   |   온라인 개인 정보 보호 정책