Use Template Sling Sample.zip from my GitHub account.
Sling uses scripts or servlets to render content. Sling uses the node’s sling:resourceType property to determine the script that renders the content. Let us see what happens when you access a url.
Assume that you access the following url: http://localhost:4502/content/aem-company.html. First, the request goes to /content/aem-company. The node has a sling:resourceType property that points to aem-company/components/homepage. Here Sling gets the location of the script or servlet that needs to be used to render the content. It checks for the location in the apps folder and locates the node. And, then render the content based on the default script, body.html. I have explained how body.html becomes the default script in one of the previous posts. Have a look at that.
- Now create another script in aem-company/components/homepage. (test.html)
- Add a test content: html test page
- Let us access the page again with a different url: http://localhost:4502/content/aem-company.test.html
- Create another script at the same location. (details.jsp)
- Add a test content: jsp test page
- Access the same using the following url: http://localhost:4504/content/aem-company.details.html
This kind of script resolution mechanism Sling uses is important for you to know. See a cheat sheet Adobe prepared: http://dev.day.com/content/ddc/blog/2008/07/cheatsheet.html
Take a look at this page – there are plenty of information. I hope you got a general idea about Sling now. Consider it as a starting point & happy learning.
See you soon.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.