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

Need to create sling model

Avatar

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile
manikanthar1295
Level 3

02-01-2019

Hi,

I have tried to create sling model in AEM 6.4 i have followed Adobe Experience Manager Help | Creating Adobe Experience Manager 6.3 Sling Model Components

i have gone to http://localhost:4502/crx/de/index.jsp#/content/testsling

i have create folder under content called testsling but after that which type of node i  need to create i'm not getting

bellow are the screen shot

1658570_pastedImage_3.png

I will be help full if any one explain how i  which node i need to select while creating the sling model.

Regards

Manikantha R

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,429 likes

Total Posts

3,304 posts

Correct Reply

937 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,429 likes

Total Posts

3,304 posts

Correct Reply

937 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

02-01-2019

Hi,

In above tutorial test node is created to store only data, that is not related to sling model. you can create test sling folder and then nt:unstructured node as mentioned in screenshots in the helpx document.

You can read more about sling model at Apache Sling :: Sling Models

Avatar

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile
manikanthar1295
Level 3

02-01-2019

Hi Arun,

Thanks for your quick response.

According to you we are not using below sling model  right in tutorial.

package SlingModel63.core;

import javax.inject.Inject;

import org.apache.sling.api.resource.Resource;

import org.apache.sling.models.annotations.Model;

 

@Model(adaptables = Resource.class)

public class UserInfo {

    @Inject

    private String firstName;

    @Inject

    private String lastName;

    @Inject

    private String technology;

     

    public String getFirstName() {

        return firstName;

    }

    public String getLastName() {

        return lastName;

    }

    public String getTechnology() {

        return technology;

    }

 

}

Correct me if i'm wrong.

Regards

Manikantha R

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

03-01-2019

Hi Manikanta,

We are using sling models in that article and please make note the purpose of Sling models is to define the model object i.e., java object and map that object to Sling resources.

package SlingModel63.core;

import javax.inject.Inject;

import org.apache.sling.api.resource.Resource;

import org.apache.sling.models.annotations.Model;

@Model(adaptables = Resource.class)

public class UserInfo {

    @Inject

    private String firstName;

    @Inject

    private String lastName;

    @Inject

    private String technology;

    

    public String getFirstName() {

        return firstName;

    }

    public String getLastName() {

        return lastName;

    }

    public String getTechnology() {

        return technology;

    }

}

In above code you are defining the java objects and map that into sling resources of that slingmodel node as in the screenshot.

Its just a node you can create and get that node using resource object and map that objects to sling resources.

Resource resource = resolver.getResource("/content/testsling/slingmodel");

Hence node called testsling/slingmodel is only dummy node we created to store the data for our reference and its not related to Sling models.

Hope this helps!!

Thanks,

Ratna Kumar.

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

03-01-2019

Best way to install the package in the start of the article and test it. The testsling node is of type sling:Folder and slingmodel node is of type nt:unstructured. Below is the screenshot.

1659246_pastedImage_1.png

Hope this helps!!

Thanks,

Ratna Kumar.

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

159 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

03-01-2019

Also, remember please don't create the folder. Create node -> testsling with type sling:Folder!!!

Avatar

Avatar
Ignite 1
Level 3
rampai
Level 3

Likes

25 likes

Total Posts

54 posts

Correct Reply

9 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

25 likes

Total Posts

54 posts

Correct Reply

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

03-01-2019

Yes Ratna Kumar​ is right, nt:unstructured nodes cannot go under nt:folder node. If you try to do this you will get a 409 conflict error. Nodes of type nt:unstructured can only be created under a node of type sling:Folder if you want a folder per se.

Avatar

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Affirm 1
Level 3
manikanthar1295
Level 3

Likes

7 likes

Total Posts

85 posts

Correct Reply

1 solution
Top badges earned
Affirm 1
Validate 25
Give Back 10
Give Back 5
Give Back 3
View profile
manikanthar1295
Level 3

03-01-2019

Hi Ratna kumar,

Thanks for your response here.

I was created the normal folder called testsling

Regards

Manikantha R