Finest way to exchange data between AEM components. | Community
Skip to main content
xistin
New Participant
Dec 8, 2015 5:18 AM UTC
Solved

Finest way to exchange data between AEM components.

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
edubey
edubeyAccepted solution
Level 10
Dec 8, 2015 5:53 AM UTC

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

3 replies

Level 2
Jun 12, 2018 7:04 AM UTC

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

Translate
kautuk_sahni
Employee
Dec 8, 2015 8:08 AM UTC

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

Translate
Kautuk Sahni
edubey
edubeyAccepted solution
Level 10
Dec 8, 2015 5:53 AM UTC

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

Translate