Created
September 30, 2025 19:21
-
-
Save VivekSaha/88715c50d12146900c2bedf0dff7e007 to your computer and use it in GitHub Desktop.
AEM - Textarea Component using Sling Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //C:\aem-project\aemgeeks\core\src\main\java\com\aemgeeks\core\models\TextareaSampleComponentModel.java | |
| package com.aemgeeks.core.models; | |
| import org.apache.sling.api.resource.Resource; | |
| import org.apache.sling.models.annotations.DefaultInjectionStrategy; | |
| import org.apache.sling.models.annotations.Model; | |
| import javax.inject.Inject; | |
| @Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) | |
| public class TextareaSampleComponentModel { | |
| @Inject | |
| private String message; | |
| @Inject | |
| private String address; | |
| @Inject | |
| private String comment; | |
| public String getMessage() { | |
| return message; | |
| } | |
| public String getAddress() { | |
| return address; | |
| } | |
| public String getComment() { | |
| return comment; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //C:\aem-project\aemgeeks\ui.apps\src\main\content\jcr_root\apps\aemgeeks\components\AEMComponent\textareasamplecomponentwithdialogcrxd\textareasamplecomponentwithdialogcrxd.html | |
| <sly data-sly-use.infoUser="com.aemgeeks.core.models.TextareaSampleComponentModel"> | |
| <p>${infoUser.message}</p> | |
| <p>${infoUser.address}</p> | |
| <p>${infoUser.comment}</p> | |
| </sly> | |
| <sly data-sly-use.templates="core/wcm/components/commons/v1/templates.html" /> | |
| <sly data-sly-call="${templates.placeholder @ isEmpty = !infoUser.message}" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //C:\aem-project\aemgeeks\ui.apps\src\main\content\jcr_root\apps\aemgeeks\components\AEMComponent\textareasamplecomponentwithdialogcrxd\.content.xml | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" | |
| jcr:primaryType="cq:Component" | |
| jcr:title="Textarea Sample Component with Dialog CRXD" | |
| componentGroup="AEM Geeks - Content"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //C:\aem-project\aemgeeks\ui.apps\src\main\content\jcr_root\apps\aemgeeks\components\AEMComponent\textareasamplecomponentwithdialogcrxd\_cq_dialog\.content.xml | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" | |
| jcr:primaryType="nt:unstructured" | |
| jcr:title="Basic Infomation" | |
| sling:resourceType="cq/gui/components/authoring/dialog"> | |
| <content | |
| jcr:primaryType="nt:unstructured" | |
| sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns"> | |
| <items jcr:primaryType="nt:unstructured"> | |
| <column | |
| jcr:primaryType="nt:unstructured" | |
| sling:resourceType="granite/ui/components/coral/foundation/container"> | |
| <items jcr:primaryType="nt:unstructured"> | |
| <message | |
| jcr:primaryType="nt:unstructured" | |
| sling:resourceType="granite/ui/components/coral/foundation/form/textarea" | |
| fieldLabel="Message" | |
| name="./message"/> | |
| <address | |
| jcr:primaryType="nt:unstructured" | |
| sling:resourceType="granite/ui/components/coral/foundation/form/textarea" | |
| fieldLabel="Address" | |
| name="./address"/> | |
| <comment | |
| jcr:primaryType="nt:unstructured" | |
| sling:resourceType="granite/ui/components/coral/foundation/form/textarea" | |
| fieldLabel="Comment" | |
| name="./comment"/> | |
| </items> | |
| </column> | |
| </items> | |
| </content> | |
| </jcr:root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment