Saturday, June 22, 2013

Basic of CQ5

 If you are a developer from Java/JSP background with decent experience of JavaScript, AJAX, XML, JSON and CSS you can start immediately with CQ5.
 CQ5  follows a template, page and component based development methodology.

Every page that we build for our website has some template. Template itself does not have any rendering logic, a template is just a logical unit in CQ5 environment which groups certain pages that shares common features (features can be functional or non functional). For example, we have a group of pages that users can access without logging in (these are static/public pages), these pages have common feature (i.e. they are public, it is functional feature) and share common headers and footers (this is non-functional/rendering feature). As I mentioned above that template itself does not have any rendering logic then a general question that you might ask “how the pages are getting rendered?”, well we need to define a resource/page (cq:Page) that can will render the template.

To create a page on our web site we need a template and to render a template we need a page. A page is combination of one or more resources (Java classes, JSP etc.), and the primary goal of a page to create page structure (ex. Two column with a header or one column with header and footer) in which components can be placed. So a page renders blank container and we need to place components in it, this is real power of CQ5. We can add and remove components on a page, we can change their position of components and even we can extend a page and add/remove components from extended pages.

 Component (cq:Component)
 Component is a reusable entity that we can place on any number of pages. As pages can be extended to add/remove functionality similarly a component can also be extended to add/remove functionality. Components are the smallest building block of a page and usually a component is composed of various resources (Java classes, JSPs, JS).Components can be hardcoded within the page component i.e (cq:page) or can be drag-n-drop into the page containing the parsys i.e the place holder.