
AEM Blog
62 FOLLOWERS
AEM Blog is a place for the beginner to start and a good refresher for experienced AEM developers. Get to know all about AEM like utilizing the same dialog structure in multiple components, what is Sling Resource Merger, what is Sling Servlet, and many more!
AEM Blog
1M ago
Ever wondered how the permissions are assigned to the visitor of a site in case if it doesn't have a login system?
This is done by providing access to the user named anonymous. It holds the permission for unauthenticated access to an AEM instance. If you accidentally delete this account, it is re-created on startup. It cannot be permanently deleted, but it can be disabled ..read more
AEM Blog
4M ago
I recently worked upon a use-case where I had to register a sling servlet with dynamic paths, and following is how I implemented it:
To designate an ObjectClassDefinition to the Servlet which on save of the configuration, sets the servlet.servlets.paths property of the servlet.
@Component(service = Servlet.class)
@Designate(ocd = DynamicallyRegisteredServlet.Config.class)
public class DynamicallyRegisteredServlet extends SlingSafeMethodsServlet {
private static final long serialVersionUID = 1L;
@ObjectClassDefinition(name = "DynamicallyRegisteredServlet ..read more
AEM Blog
4M ago
A JOB is an action which is guaranteed to be performed at least once and its state is persisted under node /var/eventing/jobs.
A Job's at least once execution can't be guaranteed if the AEM instance that is processing the job itself crashes after processing the job but before persisting its state. That's quite rare.
When would you use job to perform a task?
Following are few use cases where Job can be used:
Store Reports
Workflow Automation
Email Notification
How do we trigger a job?
A Job is triggered using a JobConsumer OSGI Service which is registered to one or more topics.
Every Job has ..read more
AEM Blog
5M ago
Nope, it is not!
Following are the Injectors Available:
Scripting Bindings
ValueMap (We will specifically talk about this annotation on this post)
Child Resource
Request Attribute
Resource path
OSGi service
Context-Aware Configuration
Self
Sling Object
@Inject iterates through all available injectors and injects the first non-null value provided by an injector. This lead to unpredictable behavior, although the order is well-defined. Also, this turned out to be a performance bottleneck, especially if (optional) injections were not successful, and then all other injectors have to be tried.
Whe ..read more
AEM Blog
10M ago
Let's refer Multifield we created here, which has following fields:
Following HTML uses Sling Model to access multifield values:
Title: ${multifielditem.name}
URL: ${multifielditem.url}
Following HTML uses Global Object resource to access multifield values:
Title: ${multifielditem.name}
URL: ${multifielditem.url}
Using HTL for accessing Multifield values comes handy when no custom processing is required on dialog values ..read more
AEM Blog
10M ago
In simple terms, Sling Model is a java class that facilitates injection of data from JCR into a Java variable.
Let's take an example of a Simple Text Field "Title".
We can access its value directly like this ${properties.title}.
However, What if we need to write some custom business logic based on this value? To do so we utilize Sling Model.
Now, lets write a Sling Model for this field.
import javax.annotation.PostConstruct;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.DefaultInjectionStrategy;
import org.apache.sling.models.annotations.Model;
imp ..read more
AEM Blog
1y ago
Today we will generate an AEM Project using a Maven archetype with the help of command line.
Prerequisites:
JDK should be installed
Maven should be installed
What is Maven Project? Apache Maven is a software project management and comprehension tool. All Adobe Experience Manager Projects leverage Maven Project to generate, build, and deploy code.
What is Maven Archetype? Archetype is a Maven project templating toolkit. AEM requires project code to be in particular structure. To generate this pre-created structure we use "aem-project-archetype" as an Archetype Id.
Paste the following into t ..read more
AEM Blog
1y ago
1. Install AEM Developer Tools from Eclipse Marketplace.
2. Convert modules such as ui.apps and ui.content to "Content Project". This can be done by right clicking on the module folder -> Configure -> Convert to Content Project. Similarly, convert core module to "Bundle Project".
3. Create a server configuration: Follow the video to create a server configuration.
https://video.wixstatic.com/video/2c375d_2c63c61e8b5c453fbc8e1676ca6053c8/1080p/mp4/file.mp4
4. Update the details in server configuration to match your AEM local instance. [Publish Modify Settings-> I personally set this t ..read more
AEM Blog
1y ago
Overriding/Extend:
You can inherit component properties by using sling:resourceSuperType property.
Example:
In this example we will override image component.
After creating the component, delete .jsp file created under the node. Add the component to the page. This is how the dialog would appear. This dialog is inherited from the image component.
Now, let's say you need to change text of first check box. To do so you need to recreate dialog structure till that checkbox field (You can keep all the created nodes empty and of type nt:unstructured.). To override text of the checkbox add highlight ..read more
AEM Blog
1y ago
What is a Multi-field?
Mulitifield allows you to create a set of input fields. Let's take Header Navigation Items as an example. In such case navigation items count is not constant and thus we need cannot create fixed list of fields. So, instead we will create a multi-field.
Let's create a multi-field with following input fields.
Name
URL
Steps to create nodes:(For all steps create nodes of type nt:unstructured)
1. Create node called "multifieldcollection" with following properties:
sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
composite="{Boolean}true"
fieldDe ..read more