Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Date Date
Qty:
Subtotal
Promotions
Estimated Shipping
VAT
Calculated at checkout
Total
Checkout
Adobe CQ Help / 

Integrating custom CQ widgets with third-party libraries

Adobe Community Help


Products Affected

  • Adobe CQ

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

Article summary

Summary
Discusses how to integrate a third-party library with Adobe CQ. In this example, Google MAP APIs are used.
Digital Marketing Solution(s) Adobe Experience Manager (Adobe CQ)
Audience
Developer (intermediate)
Required Skills
JavaScript, JQuery, CSS
Tested On Adobe CQ 5.5, Adobe CQ 5.6

Introduction

You can create a CQ widget that displays rich data by integrating with third-party libraries. For example, assume that you have a requirement to display a visual map on a web page. To address this requirement, create a CQ widget that integrates with the Google Map API.



Caption: A CQ component displaying a map

Create a CQ widget that integrates with the Google Map API by performing these steps:

  1. Create an Adobe CQ application folder structure.
  2. Create a template on which the render component is based.
  3. Create a render component that uses the Google Map API.
  4. Create a site that contains a page that displays a map.

Note:

This development article discusses how to integrate with the Google Map API to create a CQ widget that displays data. You can integrate with other third party APIs such as JQuery. For information, see Integrating the JQuery Framework into Adobe CQ.

To the top

Create a CQ application folder structure

Your first step is to create an application folder structure that contains templates, components, and pages by using CRXDE Lite. 



Caption: A typical CQ application folder structure

This list describes each application folder:

  • Application name folder: Contains all of the resources that an application uses. The resources can be templates, pages, components, and so on.
  • components folder: Contains components that your application uses.
  • page folder: Contains page components. A page component is a script such as a JSP file.
  • global: Contains global components that your application uses (common may be a substitute for global).
  • templates folder: Contains templates that you can base page components on.
  • src folder: Contains source code that comprises an OSGi component (this example does not use an OSGi component).
  • install folder: Contains a compiled OSGi bundles container.

The following illustration shows the folder structure that is created for this CQ application. Notice that the application name is applicationMap.



Caption: The Navigator view in CRXDE

Create an application folder structure in CRXDE Lite

  1. Go to the CQ welcome page at http://[host name]:[port]; for example, http://localhost:4502.
  2. Select CRXDE Lite.
  3. Right-click the apps folder (or the parent folder), select Create, Create Folder.
  4. Enter the folder name into the Create Folder dialog box. Enter appliationMap.
  5. Repeat steps 1-4 for each folder specified in the previous illustration.
  6. Click the Save All button.

Note:

You have to click the Save All button when working in CRXDE Lite for the changes to be made.

To the top

Create a template for the map widget

Create a CQ template by using CRXDE Lite that defines a consistent style for the pages in your CQ application. A template comprises of nodes that specify the page structure. For more information about templates, see http://dev.day.com/docs/en/cq/current/developing/templates.html.

Create a template by using CRXDE Lite

1. Go to the CQ welcome page at http://[host name]:[port]; for example, http://localhost:4502.

2. Select CRXDE Lite.

3. Right-click the template folder (within your application), select Create, Create Template.

4. Enter the following information into the Create Template dialog box:

  • Label: The name of the template to create. Enter maptemplate.
  • Title: The title that is assigned to the template
  • Description: The description that is assigned to the template
  • Resource Type: The component's path that is assigned to the template and copied to implementing pages. Enter applicationmap/components/page/maptemplate.
  • Ranking: The order (ascending) in which this template appears in relation to other templates. Setting this value to 1 ensures that the template appears first in the list.  Add a path to Allowed Paths. Click on the plus sign and enter the following value: /content(/.*)?.

  5. Click Next for Allowed Parents.

  6. Select OK on Allowed Children.

To the top

Create a render component that uses Google Map APIs

Components are re-usable modules that implement specific application logic to render the content of your web site. You can think of a component as a collection of scripts (for example, JSPs, Java servlets, and so on) that completely realize a specific function. In order to realize this functionality, it is your responsibility as a CQ developer to create scripts that perform specific functionality. For more information about components, see http://dev.day.com/docs/en/cq/current/developing/components.html.

Note:

By default, a component has at least one default script, identical to the component's name.

The CQ widget uses Google Map APIs to display map data. To use the Google Map APIs, obtain a Google Map API key. For information, see https://developers.google.com/maps/documentation/javascript/tutorial#api_key.



Caption: A CQ widget that lets a user specify latitude and longitude values and view the results

Create a render component that uses the Google Map APIs

1. Go to the CQ welcome page at http://[host name]:[port]; for example, http://localhost:4502.

2. Select CRXDE Lite.

3. Right-click /apps/applicationmap/components/page, then select Create, Create Component.

4. Enter the following information into the Create Component dialog box:

  • Label: The name of the component. Enter maptemplate.
  • Title: The title that is assigned to the component
  • Description: The description that is assigned to the template

5. Select Next for Advanced Component Settings and Allowed Parents.

6. Select OK on Allowed Children.

7. Open the maptemplate.jps located at: /apps/applicationmap/components/page/maptemplate/maptemplate.jsp.

8. Enter the following JSP code. 

<html>
<head>
 
    <script type="text/javascript"
      src="http://maps.googleapis.com/maps/api/js?key=<your_google_map_key>&sensor=true">
    </script>
    <script type="text/javascript">
     function getMap(lat,lng) {

 	   var myOptions = {
          center: new google.maps.LatLng(lat,lng),
          zoom: 8,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(document.getElementById("map_canvas"),
            myOptions);
      }
    </script>
 <cq:include script="/libs/wcm/core/components/init/init.jsp"/>
 </head>   
  <body onload="getMap(45.516667,-74.333333)" >
    <div id="map_canvas" style="width:50%; height:50%"></div>
    <div class="grid_12 body_container">
    </body>
    
  <form >
  Latitude: <input type="text" name="lat" value="37.3041" /><br />
  Longitude: <input type="text" name="lng" value="-121.8727"/><br />
  <button type="button" onclick="getMap(lat.value,lng.value)" >Click Me!</button>
</form>
<cq:include path="par" resourceType="foundation/components/parsys" />
</div>
  
</html> 

Note:

Replace your_google_map_key with your Google key value.

To the top

Create a CQ web page that displays map data

The final task is to create a site that contains a page that is based on the maptemplate (the template created earlier in this development article).

Create a web page that displays map data

1. Go to the CQ welcome page at http://[host name]:[port]; for example, http://localhost:4502.

2. Select Websites.

3. From the left hand pane, select Websites.

4. Select New, New Page.

5. Specify the title of the page in the Title field.

6. Specify the name of the page in the Name field.

7. Select maptemplate from the template list that appears. This value represents the template that is created in this development article. If you do not see it, then repeat the steps in this development article. For example, if you made a typing mistake when entering in path information, the template will not show up in the New Page dialog box.

8. Open the new page that you created by double-clicking it in the right pane. The new page opens in a web browser. You should see a page displaying data similar to the previous illustration.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement