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

Where should I create my Sling Servlets?

Avatar

Level 2

Hi. I have the following doubt I do not know which is the correct folder where I should create my java Servlets and Sling Servlets. I'm a little confused. I'd appreciate your help.

At the moment I have been creating the servlets here:

Link: https://i.imgur.com/L6VyOSK.png

This is a screenshot of my CRX:

Link: https://i.imgur.com/C6iRvf9.png

And this is my <build> tag in D:\myproject\core\pom.xml

Link: https://i.imgur.com/8E0LbiR.png

- What I do is place myself in "D:\my-project\core" and execute "mvn clean install" in the console

- I upload the .zip created in "D:\my-project\core\target" to AEM through the link http://localhost:4502/system/console/bundles

Greetings!

1 Accepted Solution

Avatar

Correct answer by
Level 10

Correct - you create a Sling Servlet in Eclipse here  -- under the <packageName>.core.servlets:

SlingServlets.png

Then you deploy your project and the Sling Servlet is deployed as part of the OSGi bundle.

Hope this helps.

View solution in original post

5 Replies

Avatar

Level 10

Never create Java service/Sling Servlets in CRXDE lite. That is an outdated practice. Always code your Servlets in your Maven generated projects.

Avatar

Level 2

Hello smacdonald2008, thank you very much for your response.

If I understand correctly, then it is correct to create Java service/Sling Servlets in that folder called /core/servlets of my project.

Avatar

Correct answer by
Level 10

Correct - you create a Sling Servlet in Eclipse here  -- under the <packageName>.core.servlets:

SlingServlets.png

Then you deploy your project and the Sling Servlet is deployed as part of the OSGi bundle.

Hope this helps.