Finest way to exchange data between AEM components. | Community
Skip to main content
xistin
December 8, 2015
Solved

Finest way to exchange data between AEM components.

  • December 8, 2015
  • 3 replies
  • 3810 views

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.
Best answer by edubey

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

edubey
edubeyAccepted solution
Level 10
December 8, 2015

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

kautuk_sahni
Community Manager
Community Manager
December 8, 2015

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
Level 2
June 12, 2018

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