Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

sling servlet

Avatar

Level 2

Hello, I am in the process of learning about the servlet sling 
if you could please help me with a simple example of how to
save a name or any other data in a node of the crx using
the servlet sling I appreciate the collaboration

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Below servlet upload an Assets in JCR, similarly you can add node by using JCR Node API.

// Store content

Session session = request.getResourceResolver().adaptTo(Session.class);

Node adobe = req.getResourceResolver().getResource("/parent/node/path").adaptTo(Node.class);

Node day = adobe.addNode("adobe");

day.setProperty("message", "Adobe Experience Manager is part of the Adobe Digital Marketing Suite!");

session.save();

aem63app-repo/UploadAssets.java at master · arunpatidar02/aem63app-repo · GitHub

View solution in original post

0 Replies

Avatar

Correct answer by
Community Advisor

Hi,

Below servlet upload an Assets in JCR, similarly you can add node by using JCR Node API.

// Store content

Session session = request.getResourceResolver().adaptTo(Session.class);

Node adobe = req.getResourceResolver().getResource("/parent/node/path").adaptTo(Node.class);

Node day = adobe.addNode("adobe");

day.setProperty("message", "Adobe Experience Manager is part of the Adobe Digital Marketing Suite!");

session.save();

aem63app-repo/UploadAssets.java at master · arunpatidar02/aem63app-repo · GitHub