/* | |
<div data-sly-use.object="com.org.project.models.PageModel"/> | |
${object.title} | |
</div> | |
*/ | |
package com.org.project.models; | |
import org.apache.sling.api.resource.Resource; | |
import org.apache.sling.models.annotations.DefaultInjectionStrategy; | |
import org.apache.sling.models.annotations.Model; | |
import org.apache.sling.models.annotations.Required; | |
import org.apache.sling.models.annotations.injectorspecific.Self; | |
import javax.annotation.PostConstruct; | |
import javax.inject.Inject; | |
import javax.inject.Named; | |
@Model( | |
adaptables = Resource.class, | |
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) | |
public class PageModel { | |
@Self | |
private Resource resource; | |
@Inject @Named("jcr:title") @Required | |
private String title; | |
@PostConstruct | |
private void init() { | |
} | |
public String getTitle() { | |
return title; | |
} | |
} |
Thursday, 2 August 2018
Basic Sling Model Example
Subscribe to:
Post Comments (Atom)
Basic Sling Model Exporter
/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...
-
Namastey, Templates are basis of AEM page. Author can create a page using a template . These templates define basic structure of the ...
-
Namastey, If you are working on your local machine and have created a sling servlet to make post request to local AEM Server , you may be...
No comments:
Post a Comment