Can I get some code for fetching component properties from a java class.
I'm working on a component which requires some properties that the user sets during run time.
Initially, I was simply using a properties.get('employeename') to fetch this property from my component(JSP), but I'm trying collect this value from a java bean.
How to fetch this property 'employeename' (which is set during runtime on my component) within my Java code?
We can achieve this by using third party AEM frameworks like Slice,Bedrock etc.But I didn't want these frameworks.
Refer : http://code.citytechinc.com/bedrock/component-framework.html
Solved! Go to Solution.
Views
Replies
Total Likes
I would say from to use as much as you can the ValueMap-approach.
Page page = currentPage;
ValueMap props = page.getContentResource("componentName").adaptTo(ValueMap.class);
String title = props.get("jcr:title", "default value");
Views
Replies
Total Likes
Hi,
Its seems like you want to read properties from java class Refer here [1]
[1] https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html
Please refer above link for fetching properties.
Let me know if it doesn't help
Views
Replies
Total Likes
I'm working on a component which requires some properties that the user sets during run time.
Initially, I was simply using a properties.get('employeename') to fetch this property from my component(JSP), but I'm trying collect this value from a java bean.
How to fetch this property 'employeename' (which is set during runtime on my component) within my Java code?
We can achieve this by using third party AEM frameworks like Slice,Bedrock etc.But I didn't want these frameworks.
Views
Replies
Total Likes
This is one of the way
Page page = currentPage;
Node node = page.getContentResource("componentName").adaptTo(Node.class);
String title = node.getProperties("jcr:title").getString();
and similarly fetch all any properties from the component
I would say from to use as much as you can the ValueMap-approach.
Page page = currentPage;
ValueMap props = page.getContentResource("componentName").adaptTo(ValueMap.class);
String title = props.get("jcr:title", "default value");
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies