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
BedrockMission!

Learn more

View all

Sign in to view all badges

Sling Model | AEM Community Blog Seeding

kautuk_sahni
Community Manager
Community Manager

BlogImage.jpg

Sling Model by Techinnovia

Abstract

Objectives

After reading this article, you should have an

Understand of Sling Models
Benefits of Sling Models
Understand how to use Sling Models in an HTL template
Development Goals

Sling Models are available since AEM 6.0 but can also be installed in CQ 5.6.1.
Main advantages of using Sling Models are

Reusability
You can write your code based on design patterns. If you use Sling Models you can remove all business logic from JSP and do not scriplets.

Maintenance
It’s easier to test Sling Models, because they are Java classes and can be covered with unit test. Also, it’s easier to add logging.

Scalability
Costs for introducing of new developers are lower And development is faster.
What is Sling Models? – Old Approach

public class OldModel {
private String title;
private String decription;
public String getTitle(){ ... }
public void setTitle(String title){ ... }
public String getDescription(){ ... }
public void setDescription(String description){ ... }
}


Let’s get familiar with the life before Sling Models. Let’s look at this eg. Let’s say you need to Adapt a resource to the class which has number of properties, such as title & description for that we need to create a Java bean with private fields, getters & setters.

Read Full Blog

Sling Model

Q&A

Please use this thread to ask the related questions.

AEM AEMEBlogSeeding Experience Manager
0 Replies