この会話は、活動がないためロックされています。新しい投稿を作成してください。
この会話は、活動がないためロックされています。新しい投稿を作成してください。
I need to retrieve the internal node structure(which is nothing but including the node structure of how the components of the page are stored in the JCR) of the page and render the UI giving the path of the page in aem6.3. Can anyone help me out?
表示
返信
いいね!の合計
Try this String nodePath = "/content/community-components/en"; try { Node node = null; NodeIterator nodes =null; String result=""; resource = slingRequest.getResourceResolver().getResource(nodePath); if(resource != null) { node = resource.adaptTo(Node.class); NodeIterator nodeItr = node.getNodes(); while(nodeItr.hasNext()) { Node cNode = nodeItr.nextNode(); result=node.getProperty("jcr:primaryType").getValue().getString(); out.print(result); } } } catch(Exception e) { out.print(e); } or http://keysandstrokes.info/aem-code-snippets-read-child-nodes-aem/
表示
返信
いいね!の合計
Can you please let me know whether retrieval of the data in json format which is achieved using javascript use-api in aem6.3?
表示
返信
いいね!の合計
use the below js to get page nodes use(function () { var pageName = currentPage.name; var title = currentPage.properties.get("jcr:title"); var resourceName = granite.resource.name; var resourceTitle = properties.get("jcr:title"); return { pageName: pageName, title: title, resourceName: resourceName, resourceTitle: resourceTitle }; }); refer to examples here https://helpx.adobe.com/experience-manager/htl/using/use-api-javascript.html
表示
返信
いいね!の合計
use these objects to get node structure https://helpx.adobe.com/experience-manager/htl/using/global-objects.html
表示
返信
いいね!の合計
What business case are you supporting with this information. Purhaps there is another way to achieve your requirements.
表示
返信
いいね!の合計
In the above image 'fr' is the page while giving the path of the page in the UI, it should retrieve the nodes and properties of them in a particular format(preferably in json), Is there anyways to do it using javascript use apis or anyother means?
表示
返信
いいね!の合計
Hi Malarvizhi Saravanan :
I would suggest you to use AEM's Content Services to achieve what you want.
I is the best solution to your problem, giving you granular control over the data you would like to expose via the API.
Cheers,
Jagjeet
表示
返信
いいね!の合計
Is there any other means to do with JCR Node API to achieve this?
表示
返信
いいね!の合計
https://docs.adobe.com/docs/en/spec/jsr170/javadocs/jcr-1.0/javax/jcr/NodeIterator.html
<%
String nodePath = "/content/community-components/en";
try
{
Node node = null;
NodeIterator nodes =null;
String result="";
resource = slingRequest.getResourceResolver().getResource(nodePath);
if(resource != null)
{
node = resource.adaptTo(Node.class);
NodeIterator nodeItr = node.getNodes();
while(nodeItr.hasNext())
{
Node cNode = nodeItr.nextNode();
result=node.getProperty("jcr:primaryType").getValue().getString();
out.print(result);
}
}
}
catch(Exception e)
{
out.print(e);
}
%>
表示
返信
いいね!の合計
You can create the structure using "infinity.json". For Example, if the page path is "/content/we-retail/ca/en/men" you can get the data from "/content/we-retail/ca/en/men.infinity.json" by using javascript(ajax call)
表示
返信
いいね!の合計