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

SOLVED

Finest way to exchange data between AEM components.

xistin
Level 1
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
edubey
Correct answer by
Level 10
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
edubey
Correct answer by
Level 10
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

kautuk_sahni
Community Manager
Community Manager

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

BHAVYA_S
Level 2
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