Experince Fragment Export as Javascript Module | Community
Skip to main content
Level 2
Sep 5, 2023 5:48 AM UTC
Solved

Experince Fragment Export as Javascript Module

Hi All,

We have requirement where we need to export XF as Js so that it will be use another NON-AEM to fetch the content.

Example:

http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js 

it will display whole content of XF  and same we will refer to the other NON-AEM

 

is anyone worked on such type of requirement

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Sanjay_Bangar
Sanjay_BangarAccepted solution
New Participant
Sep 7, 2023 5:35 PM UTC

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay 

 

4 replies

Sanjay_Bangar
Sanjay_BangarAccepted solution
New Participant
Sep 7, 2023 5:35 PM UTC

Hi @test566 ,

Follow below steps

1.create the system user .

2 .creat the sling servlet in that create the session using service.

3.get the XF path using request object.

4.convert into the page object.

5 using bytecode array send to the request 

6.using bytecode you con convert into string

Thanks,

Sanjay 

 

Translate
Sady_Rifat
New Participant
Sep 5, 2023 9:48 AM UTC

Hello @test566,

You can check this article, where it will meet your requirements: https://exadel.com/news/aem-experience-fragments-consuming-outside-aem/ 

From the external source, you can add it via,

<div>External Content</div> <script src="http://localhost:4502/content/experience-fragments/maserati/xf/experience-fragment3/master.js"</script> </div>

 

Translate
test566Author
Level 2
Sep 5, 2023 9:58 AM UTC

Hi @sady_rifat ,

Currently I am following the same but its giving error so that what i asked here if someone already implemented .

Thanks

Translate
Sady_Rifat
New Participant
Sep 5, 2023 11:39 AM UTC

Then if possible, please share the error, it will be more helpful to solve it.

Translate