Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AJAX Component Configuration

Avatar

Level 2

Hi,

We have an AJAX component (components that are pulled into the page via AJAX).

Our Setup is as follows:

1. /apps/global/components/content/ajaxComponent - sling:resourceSuperType = acs-commons/components/content/base/ajax.

2. /apps/sub-project/components/global/ajaxComponent - sling:resourceSuperType = global/components/content/ajaxComponent (Component extending global component)

    This doesn't work but if I copy the ajaxComponent directly under my sub-project it works perfectly fine.

So my guess is its an issue with sling:resourceSuperType since at sub-project level we need to define it to global component and hence AJAX component is not invoked?

Any pointers?

Thanks in advance.

-Anuj Varshney

7 Replies

Avatar

Level 9

It could be a component failure. Have you explored the error.log? and please elaborate what is not working?

Regards,

Jitendra

Avatar

Level 2

I'm not seeing any error in log file. The AJAX component call is not going through.

Thanks,

Anuj

Avatar

Level 10

I am not sure what you mean by 

"We have an AJAX component (components that are pulled into the page via AJAX)"

Avatar

Level 1

I am having a very similar problem - just joining this thread in case you find a resolution - also I'll post again if/when I get it resolved.

My setup:

I have components under two directories like so:

This first one is the component I want to ajax in:

/apps/myproject/components/global/testcomponent1/ajax.jsp

The second one has the include statement:

/apps/myproject/components/content/testcomponent2/testcomponent2.jsp

with <cq:include path="testcomponent1" resource="myproject/components/global" />

It seems like it cannot go up out of the path of tescomponent2 under "content" and then down into the path for testcomponent1 under "global". Note that in my case, this is even in the same parent apps/myproject

Avatar

Level 10

I have no idea what you mean by saying:

"This first one is the component I want to ajax in"

To get a component onto an AEM page - you do 1 of 2 things: 

1 - Drag and drop the component from the side kick (in Classic) or Side rail (in Touch UI)

2 - you can use the include statement as you described in the component (ie - a page component) script. 

Typically AJAX is used in an AEM component to interact with a servlet (ie -post data to an AEM sling servlet in the OSGi service component) - not to place components in a page. 

Can you please clarify what you mean when you say:  the component I want to ajax in

Avatar

Level 10

Reading this - i think your issue is with component Inheritance and component super type - is that correct? 

Avatar

Administrator

alexk33222784 wrote...

I am having a very similar problem - just joining this thread in case you find a resolution - also I'll post again if/when I get it resolved.

My setup:

I have components under two directories like so:

This first one is the component I want to ajax in:

/apps/myproject/components/global/testcomponent1/ajax.jsp

The second one has the include statement:

/apps/myproject/components/content/testcomponent2/testcomponent2.jsp

with <cq:include path="testcomponent1" resource="myproject/components/global" />

It seems like it cannot go up out of the path of tescomponent2 under "content" and then down into the path for testcomponent1 under "global". Note that in my case, this is even in the same parent apps/myproject

 

Including component in a component by cq:include is not a best practice. If you want to use comp 1 and comp 2 together make them one component. Or keep them mutually exclusive.

cq:include is use for includes a resource into the current page not the component.

Documentation Link:- https://docs.adobe.com/docs/en/cq/5-6/howto/taglib.html

 

But we you want to pass data between the component the please refer this these post:-

Link:- http://stackoverflow.com/questions/21325733/pass-data-from-one-component-to-another-in-adobe-cq

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

 

I hope this would help.

~kautuk

Avatar

Level 2

kautuksahni wrote...

Including component in a component by cq:include is not a best practice. If you want to use comp 1 and comp 2 together make them one component. Or keep them mutually exclusive.

cq:include is use for includes a resource into the current page not the component.

Documentation Link:- https://docs.adobe.com/docs/en/cq/5-6/howto/taglib.html

 

Forgive me if I'm veering off-topic, but this statement has piqued my curiosity. I've been working exclusively with AEM 6.2, so I haven't really had a need to use cq:include, but I have used other methods of embedding a component inside another component. Is this really bad practice? The Text&Image component is comprised of the two individual components squished together - is it doing so in a different way, or should creating components like this be avoided?

Avatar

Administrator

Koblinski wrote...

kautuksahni wrote...

Including component in a component by cq:include is not a best practice. If you want to use comp 1 and comp 2 together make them one component. Or keep them mutually exclusive.

cq:include is use for includes a resource into the current page not the component.

Documentation Link:- https://docs.adobe.com/docs/en/cq/5-6/howto/taglib.html

 

Forgive me if I'm veering off-topic, but this statement has piqued my curiosity. I've been working exclusively with AEM 6.2, so I haven't really had a need to use cq:include, but I have used other methods of embedding a component inside another component. Is this really bad practice? The Text&Image component is comprised of the two individual components squished together - is it doing so in a different way, or should creating components like this be avoided?

 

Hi

For component Inheritance, best way is to use sling:resourceSuperType Demo link:- http://myadobecq.blogspot.in/2013/02/creating-inherited-component-in-cq.html

I just checked the Image-Text component :- They are not using any "cq:include" (http://localhost:4502/crx/de/index.jsp#/libs/foundation/components/textimage).

Please check the component to better understand how it has been implemented it.

~kautuk