내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Java logic is depend on Adobe Launch script execution

Avatar

Level 9

Hello all,

 

In my AEM application, in the page properties, I have added Adobe Launch script. Called this script in the page template level(in head.html section). So, during page load time, Adobe Launch script will execute and does many things. One part is it adds some details to cookies, say "launch_cookie".

My Java logic(which I am calling from few components.) will read the launch_cookie value from cookie and uses the values. Now, during page load time Java logic executes first. Then Adobe launch script is adding the value to cookies. So, during the first page load, my java logic is not getting the proper values from cookie. How can i resolve this issue?

Adobe Launch script should execute first. Then, java logic should execute.

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Employee

Hi 

 

The requirment you want to achieve is not possible because Launch Script is JS which is client side script which means it needs user browser/agent to get executed. Java code where you have written some logic on these cookies is server side script and as you mentioned when page is loaded, server side script is executed first and vice versa is not possible.

 

If you really want to achieve some task which is dependent on these cookies, you must take your logic from java(server side) to JS(client side) keeping following in mind:

  1. There are js libraries that allow to read cookies client side which you can use and apply logic and change view in your component.
  2. If logic requires server side java execution, then consider creating some servlet which you can call from js after page load. Since, cookies will be created till that time, servlet will get these cookies in request object.

Hope it helps!

Thanks,

Nupur

원본 게시물의 솔루션 보기

1 답변 개

Avatar

정확한 답변 작성자:
Employee

Hi 

 

The requirment you want to achieve is not possible because Launch Script is JS which is client side script which means it needs user browser/agent to get executed. Java code where you have written some logic on these cookies is server side script and as you mentioned when page is loaded, server side script is executed first and vice versa is not possible.

 

If you really want to achieve some task which is dependent on these cookies, you must take your logic from java(server side) to JS(client side) keeping following in mind:

  1. There are js libraries that allow to read cookies client side which you can use and apply logic and change view in your component.
  2. If logic requires server side java execution, then consider creating some servlet which you can call from js after page load. Since, cookies will be created till that time, servlet will get these cookies in request object.

Hope it helps!

Thanks,

Nupur