1 Reply Latest reply on May 20, 2013 10:36 PM by msulliva_odu

    Regarding component rendering jsp

    div_sgh Level 1


      I am new to CQ5 and I have  avery basic question. When we create a componenet generally the name of the jsp is that of component . But in some cases I have seen that a component contains multiple jsps and the name of all the jsps are different from the component. My question is which jsp is rendered first in this case. When the component is rendered which jsp which will called first as the name of all the jsps are different from the component name.

        • 1. Re: Regarding component rendering jsp

          CQ5 / AEM uses the Apache Sling web framework, which is handling which JSP is being selected for that component.  In many cases it will be the componentname.jsp but in some situations a component will superType another component, and in this case it may not even override the base jsp, but be overriding other jsps which are included by the parent.


          Never put things in libs, but the CQ base components can be overriden by placing jsps of the same name or higher precedence in apps.



              parent.jsp - includes header.jsp and footer.jsp




          /apps/myapp/components/parent - sling:resourceSuperType /libs/myapp/components/parent



          /apps/myapp/components/child - sling:resouceSuperType /apps/myapp/components/parent



          So in the above if you have a component of type "myapp/components/child" (note the apps isn't usually specified in the sling:resourceType) the /libs/myapp/components/parent/parent.jsp will get rendered as it falls through twice in it's search to the grandparent, but it includes header.jsp from the /apps/myapp/components/child, and then the footer.jsp falls through to /apps/myapp/components/parent


          Hope that helps, here are some good docs on the subject: