Expand my Community achievements bar.

SOLVED

Finest way to exchange data between AEM components.

Avatar

Level 1

Hey, I'm spending dynamic period by using your solution named AEM.

I think it's quite a good solution in maintainer's perspective, but I wonder is there a recommended way to communicate between components.

 

As using JCR as a some kind of temporary message queue seems too heavy, so I customize JS part in pre-developed AEM component when I need to transfer client-side data.

Isn't there any recommended way to transfer client-side data between components in AEM?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can create custom servlet's to which you can send the client side data via Ajax. that works in almost all cases.

Thanks

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

You can create custom servlet's to which you can send the client side data via Ajax. that works in almost all cases.

Thanks

Avatar

Administrator

Hi 

Please find few of the way of doing the same:-

Option 1:

You can use javax.jcr.Node and javax.jcr.Property interface to get properties of another component. For example, you have added component1 and component2 to page1. In the repository you should have structure similar to this:

/content /project /page1 /jcr:content /parsys /component1 /...some properties /component2 /...some properties

If you want to get properties of component2 while in component1, you can use something like:

Node parsys = currentNode.getParent(); if(parsys.hasNode("component2")) { Node component2 = parsys.getNode("component2"); if(component2.hasProperty("someProperty")) Property someProperty = component2.getProperty("someProperty"); }

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

 

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

Hi,

Is there a way we can achieve this from the front-end itself? HTL?
I have the exact requirement.

Thanks in advance.

Regards,

Bhavya S