Expand my Community achievements bar.

SOLVED

textfield value from parent page

Avatar

Level 6

Hi Team,

 

I have Page component for that i have added one text field for basic tab  i.e SITE NAME

 

  I have created multiple level child  pages based on above page component. when ever i edit child page properties i am able to see SITE NAME test field if i enter SITE NAME=abc.com its comming in page property lke SITE-name=abc.com if i leave empty i am not able to see SITE_NAME property in pages.

 

Now  the requirement is i will not enter the SITE NAME for child pages but its parent page contains SITE Name  how i will get parent page site name  child page. 

 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
2 Replies

Avatar

Level 7

Did following way not work?

 

Page currentPage = request.getResource().adaptTo(Page.class);

Page parentPage = currentPage.getParent();

String siteName = parentPage.getProperties().get("SITE-name",String.class);

Avatar

Correct answer by
Community Advisor

Hi,

Use inheritedPageProperties in sightly or use https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/in... in java



Arun Patidar