【问题标题】:cq5 include a component inside another componentcq5 在另一个组件中包含一个组件
【发布时间】:2016-01-15 16:22:19
【问题描述】:

我通常使用<cq:include path="fakepath" resourceType="/project/components/testcomponent" /> 将一个组件包含在另一个组件中,命名为“setComponent”。

假设,“setComponent”拖放到页面上,但还没有输入数据。

问题一:

第一件事是 /content 树页面级别不存在 “testcomponent”资源,当我双击“testcomponent”输入数据时,我看到对“fakepath.infinity.json”的 GET 请求,而这GET 请求失败(浏览器开发者工具控制台出现 404 错误)。 不确定,这是否是预期行为。

问题 2:

如何包含组件“/apps/project/components/testcomponent” 在父组件内使用以下标签?

<sling:include path="" />
<sling:include resource="" />
<sling:include path="" resourceType="" />

我正在教育自己正确理解并尝试查看 sling:include 是否可以摆脱我所说的 404 错误。

谢谢, 斯里

<%@include file="/libs/foundation/global.jsp"%>
<div>
     <cq:include path="navMenu"       
      resourceType="sampleproj/components/common/testMenu" />
</div>

testMenu jsp 的伪代码:

  <%@page session="false"%>
  <%@include file="/libs/foundation/global.jsp"%>
  <%@ page import="com.day.cq.commons.Doctype,
    com.day.cq.wcm.api.PageFilter,
    com.day.cq.wcm.foundation.Navigation" %>
  <ul class="nav">
      <li><a href='navitempath.html'><div>navitemtitle</div></a></li>
  </ul>

【问题讨论】:

    标签: extjs aem


    【解决方案1】:

    尝试从 resourceType 中删除多余的“/”符号

    <cq:include path="fakepath" resourceType="project/components/testcomponent" />
    

    【讨论】:

      【解决方案2】:

      如果您使用 sling:include,您正在从其他路径加载现有节点。 例如 : &lt;sling:include path="./mycomponentpath" resourceType="/apps/company/components/componentName"/&gt;

      mycomponentpath 是之前创建的一个节点,您正在将这个内容注入到您的实际组件中。

      如果你想在其他组件中包含和清空组件,你可以使用&lt;cq:include path="fakepath" resourceType="/project/components/testcomponent" /&gt;

      我需要更多信息来帮助您。可以复制一下 testcomponent jsp 吗?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-12-23
        • 2013-05-06
        • 1970-01-01
        • 1970-01-01
        • 2014-01-18
        • 2017-07-07
        • 2023-02-09
        • 2021-12-04
        相关资源
        最近更新 更多