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

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

Mark Solution

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

해결됨

Best approach to pass parameters between pages

Avatar

Level 2

Hello,

Frequently, we have to pass parameters between pages. As I started working with AEM (6.1 Sites) recently, I have some questions regarding the best approach to follow:

  • Using query parameters: I think this is the easiest way to pass parameters. However, the page will not be cached and it could be a problem if the page is "heavy".
  • Using cookies: The cost of implementation is low, but if the user disables his cookies, the parameters will be lost.
  • Using Sling Selectors: The page will be cached but in cases that we need to pass multiple parameters, it may become a little confusing.

I could list those approaches and could not decide which one I am going to follow.

Here are some examples of our scenarios:

  1. A input text and a button in page A. When clicking the button, the user is redirected to page B with a parameter containing the value of input text.
  2. A page that has 3 components that could have a custom behavior according to parameters received. Component A is affected by parameter A, Component B is affected by parameter B and Component C is affected by parameter C. None of those parameters are mandatory (component has a default behavior).
  3. Component that list pages using pagination (therefore, affected by pagination parameters).

Are there other approaches? Is there a best approach among all?

Thank you!

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Employee Advisor

Hi,

that really depends. If you need to handle these different parameters on the server, use request parameters ("?key=value"). Because caching on the dispatcher is not wanted in this case.

If you can handle the parameters on a client side (that means that the server doesn't have to be involved into processing them), you should be able to work a page, which has been taken from the dispatcher cache. So in that case you can add these parameters as a URL fragment ("#mykey=value"), so it is ignored from the server, but can be handled properly on the client side (using Javascript).

kind regards,
Jörg

원본 게시물의 솔루션 보기

6 답변 개

Avatar

Level 4

Make use of the JCR - a strength of AEM is its JCR. Component A updates NodeA and the page that uses the value reads NodeA.

http://stackoverflow.com/questions/21325733/pass-data-from-one-component-to-another-in-adobe-cq

Avatar

Community Advisor
Hi I think you can use hidden parameters in the page to pass the parameters

Avatar

Administrator

Hi

Few reference links that might help you:

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//Passing parameters between CQ pages

        It depends...

        If you just need to pass a selection, like "show med the cities in the country I selected" - use request parameter or Sling Suffix. This is always the default choice imho.

        If it is some sort of wizard, like a registration, then use the session or a cookie. That is if you need to be able to resume the flow or go back and forth. Otherwise, use request parameters.

Link:- http://stackoverflow.com/questions/21325733/pass-data-from-one-component-to-another-in-adobe-cq (it is for components, but could be used across pages as well).

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

Other options you can try - Sling Models and JSTL 

Thanks,

Jaison

Avatar

Level 9

Hi, 

To be frank, it depends on how many parameters you want to pass. For instance, if you have one parameter, use as selectors. if there are more than 2 or 3, use query string. 

You already have enough options However, just to add one more option in your list is use request headers to pass parameters.

---Jitendra

gkambara wrote...

Hello,

Frequently, we have to pass parameters between pages. As I started working with AEM (6.1 Sites) recently, I have some questions regarding the best approach to follow:

  • Using query parameters: I think this is the easiest way to pass parameters. However, the page will not be cached and it could be a problem if the page is "heavy".
  • Using cookies: The cost of implementation is low, but if the user disables his cookies, the parameters will be lost.
  • Using Sling Selectors: The page will be cached but in cases that we need to pass multiple parameters, it may become a little confusing.

I could list those approaches and could not decide which one I am going to follow.

Here are some examples of our scenarios:

  1. A input text and a button in page A. When clicking the button, the user is redirected to page B with a parameter containing the value of input text.
  2. A page that has 3 components that could have a custom behavior according to parameters received. Component A is affected by parameter A, Component B is affected by parameter B and Component C is affected by parameter C. None of those parameters are mandatory (component has a default behavior).
  3. Component that list pages using pagination (therefore, affected by pagination parameters).

Are there other approaches? Is there a best approach among all?

Thank you!

 

Avatar

정확한 답변 작성자:
Employee Advisor

Hi,

that really depends. If you need to handle these different parameters on the server, use request parameters ("?key=value"). Because caching on the dispatcher is not wanted in this case.

If you can handle the parameters on a client side (that means that the server doesn't have to be involved into processing them), you should be able to work a page, which has been taken from the dispatcher cache. So in that case you can add these parameters as a URL fragment ("#mykey=value"), so it is ignored from the server, but can be handled properly on the client side (using Javascript).

kind regards,
Jörg