Thursday, 15 February 2024

Template in AEM

What is Template?
  • Template is blue print/layout of create page with no content.
  • It is used to create page.
  • Template associated with a page rendering component.
How to create Template?

Step1:- 
  • Go to Tools
  • Select Templates


  • After clicking on the template, you'll find your project within the template.

  • After clicking on the project, you'll find your template.


  • For creating the template, select the "Create" button to proceed.

  • Here, you'll first choose the Template type.
  • such as Page template, from the available options.
Note:-It's important to select a Template type before proceeding, as you cannot create a Template without specifying the type.
  • After click Next button.
  • Give the Template title Name(For eg:- Template Demo)

  • After clicking on the "Create" button, our template is ready.




What is Parser?

  • It is a paragraph system to drag and drop component specific to your page.
folder structure of template

/conf/mysite/settings/wcm/templates/template-demo









What is Policy in Template?


  • When we click on Policy Icon 



Thursday, 8 February 2024

AEM Forms(Forms Fragment)

 Form Fragment

It's similar to how Content Fragments and Experience Fragments allow you to reuse content in various contexts. You can also create Form Fragments to reuse form fields across different forms.

for eg:-



For example, consider a book with two user identities: authors and publishers. Each identity has its own specific form – authors have one form, and publishers have another. However, both forms require the same set of fields to save an address. Instead of creating these address fields separately for each form, we can optimize efficiency by creating a Form Fragment. By doing so, we define the address fields once in the Form Fragment and then reuse it across different forms. This way, we eliminate redundancy and maintain consistency in the structure of address fields, making the development process more streamlined and manageable.

How to create Form Fragment

Step 1: 

  • Navigate to the Adobe Experience Manager (AEM) authoring environment and access the start page.
  • Select "Forms & Documents" from the available options.
  • Within the Forms & Documents section, create a folder to organize all your fragment data. For example, you can create a folder named "Form Fragments" to store your form-related fragments.


Step 2:

  • Navigate to the "Form Fragments" folder within the Adobe Experience Manager (AEM) authoring environment.
  • Create an Adaptive Form Fragment. 
  • For example, let's create a fragment for an address.
  • In the creation process, focus exclusively on the "Basic" tab. Omit the usage of the "Form Data Model" and "Advanced" tabs.
  • Provide a title for the form fragment.
  • For instance, let's name it "Address."
  • Within the "Basic" tab, select the container option and specify the desired path where you want to store your fragment. 
  • For instance, you might choose the path "conf/global" for organizational purposes.


  • you review the process, make sure to include all the necessary address fields when creating the address form fragment.
  •  Ensure that you have selected and added each required field within the "Address" form fragment, and confirm that these fields align with the information you want to capture in the address form.

  • This is your Address Fragment

  • When you open the form and find that you have already added all the necessary fields like Name and Email, but now you want to include address-related fields, navigate to the left-sided asset tab.
  • In the left-sided asset tab, search for the Adaptive Form Fragment section. Here, you will find all the fragments you have previously created.
  • Locate the address form fragment you created earlier and drag it into your form.


  • After adding the address form fragment, you'll notice that your Address panel is present, and all the fields you included when you created the fragment will appear in the form.


Monday, 5 February 2024

How to Integrate Data between AEM forms & MySQL?

How to Integrate Data between AEM forms & MySQL?

To integrate data between AEM Forms and MySQL, you can follow these steps:
  • Step 1:-
  • Download MySQL in your local environment with the help of this URL(dev.mysql.com/download).
  • Install the MySQL (during installation we have to configure root user in MySQL as well as the new user & root password).

  • Step 2:-
  • After installation you will find workbench where we can create new schema.


  • Step 3:-
  • With the help of this URL(dev.mysql.com/download).
  • click on connector/j.(MySQL connector jar file) downloaded.

  • Step 4:-
  • Open the System Console (for eg: localhost:4504/System/console/bundles)
  • than install here the downloaded jar file.


  • Note:- Make sure that installed jar file is in active mode.

  • Step 5:-
  • After installed jar file.
  • Go to Configuration Manager (for eg: localhost:4504/System/console/configMgr).
  • Here search datasource.
  • Go to Apache sling connection pooled data source and expand this and configure that data source.





  • Step 6:-
  • Data source name(*):-Whatever you provide data here that name will be available in databaseformdatamodel.
  • Data Source Service Property Name:- datasource.name(By default it is present).
  • JDBC driver class :- com.mysql.cj.jdbc.Driver.
  • JDBC connection URI:-jdbc:mysql://localhost:3306/firstaemforms
  • username:-root
  • password:-you will give those password when we given when we install MySQL in local environment.

  • After that save the configuration.
Note:- make sure that configuration is saved
  • And here we can see that databaseformdatamodel created.
  • After created go to Edit mode databaseformdatamodel database is present.


  • After that your form data modal are created 
  • If I extend the databaseformdatamodel, we can see that our created database(selfdatabases).


Note:- If you found any warning icon it means AEM Forms is not connected to MySQL.


Thanks
Matri Sharma

Servlet in AEM/Sling Servlet

  What is Servlet? A servlet is a Java class that runs on the server side where the application resides. It acts as a middle layer between t...