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 choice

Avatar

Avatar
Validate 1
Level 1
kusumam24182037
Level 1

Likes

2 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
kusumam24182037
Level 1

Likes

2 likes

Total Posts

6 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
kusumam24182037
Level 1

27-08-2019

Hi,

I have created sling model for the component.

While creating the sling model i need to specify the

@Model(adaptables = Resource.class) or @Model(adaptables=slinghttpservletrequest)

On what bases we have to select the adaptables.

I am new to AEM Kindly explain in detail to understand the concept.

Regards

Kusuma M

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 5
Level 2
scottm91515441
Level 2

Likes

5 likes

Total Posts

35 posts

Correct Reply

5 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Level 2
scottm91515441
Level 2

Likes

5 likes

Total Posts

35 posts

Correct Reply

5 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
scottm91515441
Level 2

31-08-2019

If you want to read the values that an author enters into a component dialog, then:

@Model(adaptables = Resource.class)

will be fine. For more on working with Sling Models on 6.5 - see this article -- Building Experience Manager 6.5 Components using Granite/Coral Resource Types

Answers (3)

Answers (3)

Avatar

Avatar
Give Back 5
MVP
Umesh_Sondhi
MVP

Likes

56 likes

Total Posts

64 posts

Correct Reply

28 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 50
Boost 5
View profile

Avatar
Give Back 5
MVP
Umesh_Sondhi
MVP

Likes

56 likes

Total Posts

64 posts

Correct Reply

28 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Boost 50
Boost 5
View profile
Umesh_Sondhi
MVP

30-08-2019

Hi kusumam24182037

You can refer to this two link ,it has detail description for the same and videos too.

AEM Developer Learning : Deep Dive on Sling Models in AEM6.3 : Part-1

AEM Developer Learning : Deep Dive on Sling Model in AEM 6.3 : Part-2

Happy to help !

Thanks

Avatar

Avatar
Ignite 1
Level 3
rampai
Level 3

Likes

23 likes

Total Posts

52 posts

Correct Reply

8 solutions
Top badges earned
Ignite 1
Validate 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Ignite 1
Level 3
rampai
Level 3

Likes

23 likes

Total Posts

52 posts

Correct Reply

8 solutions
Top badges earned
Ignite 1
Validate 1
Give Back 5
Give Back 3
Give Back 10
View profile
rampai
Level 3

27-08-2019

Hi kusumam24182037​,

The above links should clear your understanding.

Adapting to a SlingHttpServletRequest gives you more options to manipulate resources in general.

Moreover you can even access request params if you do so.

Adapting to a resource can be done when you just need resource properties and there is not much to do with the request.

Please check if my answer here helps.

Regards,

Ram

Avatar

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile

Avatar
Give Back 5
Employee
SonDang
Employee

Likes

17 likes

Total Posts

43 posts

Correct Reply

9 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 5
View profile
SonDang
Employee

27-08-2019