Q16.) Any custom components that you have used in your project which not relevant to out of box component ?

This is mostly an experience based question. Be prepared to give a good example of a functionality which you have done (or someone in your project did) and you consider it as the most interesting thing ever.

Personally, I explain triggering a workflow/scheduler by addition of a particular Tag from the dialog of component , which I did in one of my project.

Q17.) How can we inherit properties of one dialog to another dialog?

This is possible if the inherited component has the property name same as the base component.

  • dialog
  • text (name: “./text/content”) –xtype=textfield


  • dialog
  • text (inherited from base)  –xtype=textfield
  • textValue (not inherited from base) –xtype=textfield

However if you wish to inherit a particular Tab of a dialog from the Base component , you may use xtype="cqinclude"

Q18.) Can we create page without template ?

Yes. It’s not a good practice to create a page manually,however its achievable —

  • Create a node of type cq:Page and save.
  • Add cq:PageContent node under page node.
  • Add required properties to show the component & if you want to add some default node under this cq:PageContent node add all of them manually.

Whatever we did manually above is done by Templates in CQ5 via siteadmin console. When we create a page using template via siteadmin then siteadmin uses content page component & it copies all the child nodes under the template to a newly created page node.

Q19.) What is the difference between dialogue & design dialogue?

Dialogs & Design Dialogs are the collection of widgets used to get input from author. these are the key elements of a component as they provides a way of interaction between author and a CQ5 component. It means values inserted via author in these dialog, works as input for a component in CQ5.

Note : “Design dialogs are special kind of dialog those are available only at page design mode”.

Difference between dialog and design dialog?

Criteria Dialog Design Dialog
Definition Dialog will change the content at the page level. Design dialog will change the content at the template level.
Availability authored in edit mode authored in design mode
Naming Convention cq:Dialog node with name dialog cq:Dialog node with name design_dialog
Value Storage stored under pages jcr:content node stored under design page located under /etc/design
Accessing Values in CQ5 JSPs via properties object via currentStyle object.

Q20.) What are the possible bundle state / Lifecycle of an OSGi Bundle?

osgi lifecycle How to track lifecycle changes of OSGi bundles

A bundle has 6 states in its Lifecycle:

  1. INSTALLED: The OSGi runtime knows the bundle is there.
  2. RESOLVED: The bundle is there and all it’s prerequisites (dependencies) are available. The bundle can be started (or has been stopped).
  3. STARTING: The bundle is being started. If it has a BundleActivator class, the BundleActivator.start() method is being executed. When done, the bundle will become ACTIVE. Note: Bundles that can be activated lazily (Bundle-ActivationPolicy: lazy) stay in this state until one of their class files is loaded.
  4. ACTIVE: The bundle is running.
  5. STOPPING: The bundle is being stopped. If it has a BundleActivator class, the BundleActivator.stop() method is being executed. When done, the bundle will become RESOLVED.
  6. UNINSTALLED: The bundle has been removed from the OSGi runtime.

Q21.) What is a Resource resolver ?

The ResourceResolver defines the service API which may be used to resolve Resource objects. The resource resolver is available to the request processing servlet through the SlingHttpServletRequest.getResourceResolver() method. A resource resolver can also be created through the ResourceResolverFactory.

The ResourceResolver is also an Adaptable to get adapters to other types. A JCR based resource resolver might support adapting to the JCR Session used by the resolver to access the JCR Repository.

A ResourceResolver is generally not thread safe! As a consequence, an application which uses the resolver, its returned resources and/or objects resulting from adapting either the resolver or a resource, must provide proper synchronization to ensure no more than one thread concurrently operates against a single resolver, resource or resulting objects.


A Resource Resolver has a life cycle which begins with the creation of the Resource Resolver using any of the factory methods and ends with calling the close() method. It is very important to call the close()method once the resource resolver is not used any more to ensure any system resources are properly cleaned up.

To check whether a Resource Resolver can still be used, the isLive() method can be called.

Q22)How to create an Event Listener  ?

Event Listeners can be created using the below steps and example:

Must Read

Q23.) What are Clientlibs?

AEM provides Client-side Library Folders, which allow you to store your client-side code in the repository, organize it into categories, and define when and how each category of code is to be served to the client. The client-side library system then takes care of producing the correct links in your final webpage to load the correct code.

Read More – How to create a Client Lib

Q24.) What is a CQ5 overlay/override component?

Overlay/Override Component:
Creating a custom component by copying a foundation component to your project and modifying it based on the need. For example you copy image component from “/libs/foundation/components/image” to your site folder “/apps/testsite/components” by doing so you are creating a new component with is exactly same as Image component. After copying you can make changes to component based on your requirements. But the problem with this approach would be that if you are upgrading CQ then new version of CQ might have new implementation of “/libs/foundation/components/image” component than those changes will not be reflected in your “/apps/testsite/components/image” component, so you have to manually make those changes in custom component.

Extend Component:
Creating a custom component manually by creating all necessary nodes and setting value of “sling:superResourceType” property as “/libs/foundation/components/image”. By doing this you inherit all the feature of image component, even after upgrade you still inherit the features of image component.

Q25.) Difference between Parbase and Parsys?


Parbase is a key component as it allows components to inherit attributes from other components, similar to subclasses in object oriented languages such as Java, C++, and so on. For example, when you open the/libs/foundation/components/text node in the CRXDE Lite, you see that it has a property named sling:resourceSuperType, which references the parbase component. The parbase here defines tree scripts to render images, titles, and so on, so that all components subclassed from this parbase can use this script.

Also for image component : crop,map etc inheritd

Users do not need access to the parbase.


The paragraph system (parsys) is a compound component that allows authors to add components of different types to a page and contains all other paragraph components. Each paragraph type is represented as a component. The paragraph system itself is also a component, which contains the other paragraph components.

Q26.) Can any one tell me that how can we register the newly created servlet in

You can do so, by adding a custom method in class as below:

private void registerServlet
(BundleContext context, Servlet servlet, String alias) {

Hashtable<String, String> props = new Hashtable<String, String>();
props.put("alias", alias);
ServiceRegistration registration = context.registerService(Servlet.class.getName(), servlet, props);

Call this method in the start() method of as

public void start(BundleContext context) throws Exception {

registrations = new ArrayList();
registerServlet(context, new MetricsServlet(), "/metrics");
registerServlet(context, new HealthCheckServlet(), "/healthcheck");
registerServlet(context, new PingServlet(), "/ping");
registerServlet(context, new ThreadDumpServlet(), "/threads");

Q27.) Sling Scripts cannot be called directly in CQ5- Why?

Within Sling, scripts cannot be called directly as this would break the strict concept of a REST server; you would mix resources and representations.

If you call the representation (the script) directly you hide the resource inside your script, so the framework (Sling) no longer knows about it. Thus you lose certain features:

  • automatic handling of http methods other than GET, including:
  1. POST, PUT, DELETE which are handled with a sling default implementation
  2. the POST.jsp script in your sling:resourceType location
  • your code architecture is no longer as clean nor as clearly structured as it should be; of prime importance for large-scale development

Q28.) How to define a Sling-Servlet in CQ ?

There are two ways of doing this, either with a Sling-specific @SlingServlet annotation or with the more generic maven-scr-plugin annotations:

  1. The @SlingServlet annotation :
        resourceTypes = "sling/servlet/default",
        selectors = "hello",
        extensions = "html",
        methods = "GET")
    public class MyServlet extends SlingSafeMethodsServlet {
        protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
  2. The @Properties and @Property annotations :
    @Component(metatype = true)
        @Property(name = "sling.servlet.resourceTypes", value = "sling/servlet/default"),
        @Property(name = "sling.servlet.selectors", value = "hello"),
        @Property(name = "sling.servlet.extensions", value = "html"),
        @Property(name = "sling.servlet.methods", value = "GET")
    public class MyServlet extends SlingSafeMethodsServlet {
        protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {

Q29.) What are xtypes and how does they useful in CQ ?

This link defines all the xtypes which are out-of-the box provided by CQ5. You may also refer to the Widget API for more details

Q30.) Difference between Overlaying and Extending a component?

There is a major difference between the two of them. Read the table below for better understanding:

Criteria Overlaying Extending
Definition Use the out-of-box component and you want to add some extra feature in it. Copy the  out-of-box component into your project structure and then extend its functionality
Availability Universally available across the WEM. Not universally available across WEM as they are inherited for specific project.
Path /apps/foundation/components/xyz /apps/components/xyz
Steps to Create They are copied from “/libs/foundation/components/ ” to “/apps/foundation/components/”
They are extended by using   
    “ sling:resourceSuperType ” property
Recommendations Not recommended, as it has global affect and creates problems during CQ updates Better way to increase a component functionality


19 thoughts on “Developers

  1. Pingback: How to Prepare ? – CQ5 AEM Tricks of Trade

    • Hi, A design dialog is specific to the design of a particular template. You can access the properties as long as its for a particular template. What role does SDI has in this? Can you please explain the use case in more detail. What are you trying to achieve ?


  2. Hi Hashim,
    I am facing a problem, please help me to resolve it.
    1. I have created a page from site admin.
    2. Now I go to CRX and rename the name of that node from content folder which belongs to that page.
    3. And then after I go to siteadmin and try deleting that page. I am unable to delete that page now.

    Please help why it is happening and how can i fix?

    Thanks- Rashid


      • Yes, First I refresh teh siteadmin page and find the changes here(change in page name). Now from site admin itself I am try to delete my site page.

        I tried same with vanilla instance and found it is working. Thank You!


        • If its working in Vanilla instance with same steps, then you might have configured something in Siteadmin console. Could you check the JS errors in Console and Errors in Logs to narrow down the issue.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s