Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Sling Model | AEM Community Blog Seeding

Avatar

Administrator

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.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies