<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Quick Reference Archives - Sourced Code</title>
	<atom:link href="https://sourcedcode.com/blog/category/aem/aem-quick-reference/feed" rel="self" type="application/rss+xml" />
	<link>https://sourcedcode.com</link>
	<description>AEM Blog Made Just for You.</description>
	<lastBuildDate>Thu, 14 Sep 2023 05:32:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.8</generator>

<image>
	<url>https://sourcedcode.com/wp-content/uploads/2019/09/cropped-favicon-32x32.png</url>
	<title>Quick Reference Archives - Sourced Code</title>
	<link>https://sourcedcode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Retrieving the Current Page in an AEM Servlet via ResourceType</title>
		<link>https://sourcedcode.com/blog/aem/retrieving-the-current-page-in-an-aem-servlet-via-resourcetype</link>
					<comments>https://sourcedcode.com/blog/aem/retrieving-the-current-page-in-an-aem-servlet-via-resourcetype#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Wed, 06 Sep 2023 03:48:43 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Sling Servlet]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=6104</guid>

					<description><![CDATA[<p>In the context of &#8220;Retrieving the Current Page in an AEM Servlet via ResourceType&#8221;, it is great to understand how this is done. This guide provides a simplified walkthrough on how you can adeptly achieve this. In the code example, we will associating the servlet with a resourceType. 123456789101112131415161718192021222324252627282930313233343536373839package com.example.aem.servlets; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/retrieving-the-current-page-in-an-aem-servlet-via-resourcetype">Retrieving the Current Page in an AEM Servlet via ResourceType</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In the context of &#8220;Retrieving the Current Page in an AEM Servlet via ResourceType&#8221;, it is great to understand how this is done. This guide provides a simplified walkthrough on how you can adeptly achieve this. In the code example, we will associating the servlet with a resourceType.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.example.aem.servlets</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.servlets.SlingAllMethodsServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.injectorspecific.Self</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Component</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.resource.ResourceResolver</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.wcm.api.Page</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.wcm.api.PageManager</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.Servlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Optional</span><span style="color: #339933;">;</span><br />
<br />
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span>service <span style="color: #339933;">=</span> Servlet.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
@SlingServletResourceTypes<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; resourceTypes<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;example/components/content/mycomponent&quot;</span>,<br />
&nbsp; &nbsp; methods<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GET&quot;</span>,<br />
&nbsp; &nbsp; extensions<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;html&quot;</span><br />
<span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ResourceTypeServlet <span style="color: #000000; font-weight: bold;">extends</span> SlingAllMethodsServlet <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; @Self<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletRequest request<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Page currentPage <span style="color: #339933;">=</span> Optional.<span style="color: #006633;">ofNullable</span><span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getResourceResolver</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">adaptTo</span><span style="color: #009900;">&#40;</span>PageManager.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">map</span><span style="color: #009900;">&#40;</span>pm <span style="color: #339933;">-&gt;</span> pm.<span style="color: #006633;">getContainingPage</span><span style="color: #009900;">&#40;</span>request.<span style="color: #006633;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.<span style="color: #006633;">orElse</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>currentPage <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Gotcha! Current page is: &quot;</span> <span style="color: #339933;">+</span> currentPage.<span style="color: #006633;">getPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Oops, couldn't find the current page.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<hr class="spacer-larger" />
<h2>Understanding the AEM Code Snippet</h2>
<h3>1. <span class="code-highlight-secondary">request.getResourceResolver().adaptTo(PageManager.class)</span>:</h3>
<p><span class="code-highlight-secondary">request.getResourceResolver()</span>: This fetches a <span class="code-highlight-secondary">ResourceResolver</span> from the servlet&#8217;s request. A <span class="code-highlight-secondary">ResourceResolver</span> in AEM assists in translating resource paths to actual resources.</p>
<p><span class="code-highlight-secondary">.adaptTo(PageManager.class)</span>: This method tries to adapt or convert the <span class="code-highlight-secondary">ResourceResolver</span> into another type, specifically a <span class="code-highlight-secondary">PageManager</span>. The <span class="code-highlight-secondary">PageManager</span> in AEM offers utilities for working with pages, such as fetching, creating, or deleting pages.</p>
<hr class="spacer-large" />
<h3>2. <span class="code-highlight-secondary">Optional.ofNullable(&#8230;)</span></h3>
<p>This wraps the value returned by the preceding code (which might be a <span class="code-highlight-secondary">PageManager</span> object or <span class="code-highlight-secondary">null</span> if the adaptation failed) within an <span class="code-highlight-secondary">Optional</span> object. <span class="code-highlight-secondary">Optional</span> is a container that may or may not contain a value.</p>
<hr class="spacer-large" />
<h3>3. <span class="code-highlight-secondary">.map(pm -> pm.getContainingPage(request.getResource()))</span></h3>
<p>If the <span class="code-highlight-secondary">Optional</span> contains a non-null <span class="code-highlight-secondary">PageManager</span> value, the <span class="code-highlight-secondary">.map</span> method applies the given function to it. Here, it uses the <span class="code-highlight-secondary">PageManager</span> (denoted as <span class="code-highlight-secondary">pm</span> in the lambda) to retrieve the containing page of the present resource.</p>
<p><span class="code-highlight-secondary">pm.getContainingPage(request.getResource())</span>: This extracts the AEM Page that encompasses the current resource.</p>
<hr class="spacer-large" />
<h3>4. <span class="code-highlight-secondary">.orElse(null)</span></h3>
<p>Lastly, if any prior steps don&#8217;t succeed (i.e., if the adaptation to <span class="code-highlight-secondary">PageManager</span> was unsuccessful or if no containing page for the resource exists), the <span class="code-highlight-secondary">orElse</span> method ensures <span class="code-highlight-secondary">currentPage</span> is set to <span class="code-highlight-secondary">null</span>.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/retrieving-the-current-page-in-an-aem-servlet-via-resourcetype">Retrieving the Current Page in an AEM Servlet via ResourceType</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/retrieving-the-current-page-in-an-aem-servlet-via-resourcetype/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to access Design Dialogue Properties in Sling Model</title>
		<link>https://sourcedcode.com/blog/aem/how-to-access-design-dialogue-properties-in-sling-model</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-access-design-dialogue-properties-in-sling-model#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Fri, 25 Aug 2023 21:37:11 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Short Post]]></category>
		<category><![CDATA[Sling Servlet]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=5962</guid>

					<description><![CDATA[<p>Design Dialogs are especially useful for creating components that need to be easily configurable through editable template and policies without directly editing the underlying code. They enable a clear separation between content and presentation, allowing content authors to make changes without needing technical expertise. Design Dialogs are defined using the AEM Touch UI Dialog, which [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-access-design-dialogue-properties-in-sling-model">How to access Design Dialogue Properties in Sling Model</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Design Dialogs are especially useful for creating components that need to be easily configurable through editable template and policies without directly editing the underlying code. They enable a clear separation between content and presentation, allowing content authors to make changes without needing technical expertise. Design Dialogs are defined using the AEM Touch UI Dialog, which is an integral part of the component development process.</p>
<p>In this article we will talk through how to access the design dialogue settings that is configured in editable template policies within Sling Models. This article will be a quick reference, which means we will provide you code examples for the solution.</p>
<hr class="spacer-larger"/>
<h2>1. Example _cq_design_dialog.xml configuration</h2>
<p>This is a snippet that resides in /apps/core/wcm/components/title/v1/title/_cq_design_dialog.xml</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">&lt;</span>advancedSettings<br />
&nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; jcr<span style="color: #339933;">:</span>title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Advanced Settings&quot;</span><br />
&nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><br />
&nbsp; &nbsp; margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>renderLayoutAs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/form/select&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldDescription<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Forcing the component to render column layouts as&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Render Layout As&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;./renderLayoutAs&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>oneColumn<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Default (One Column)&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selected<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;oneColumn&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>twoColumns<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Two Columns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; selected<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;twoColumns&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>threeColumns<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Three Columns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;threeColumns&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>fourColumns<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Four Columns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fourColumns&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>renderLayoutAs<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;/</span>advancedSettings<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<hr class="spacer-larger"/>
<h2>2. Accessing Design Dialog Properties in Sling Models:</h2>
<p>In AEM, Sling Models provide a way to map resource properties to Java objects, making it easier to work with the content of a page. To access Design Dialog properties within a Sling Model, take a look at the example code below.</p>
<p>Take notice, in line:17, we are using <a href="/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide" rel="noopener" target="_blank">Sling Model Specific Annotations, @ScriptVariable</a>, to initiate the currentStyle object. In line:22, we are calling the get method() which is a public method, which here we will attempt to find configuration set via design dialog &#8220;renderLayoutAs&#8221;. If &#8220;renderLayoutAs&#8221; is not configured, then String renderLayoutAs == null. Finally in line:24, we will use a switch statement to execute code based on what is configured.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.core.internal.components</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.wcm.api.designer.Style</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Model</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.annotation.PostConstruct</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.inject.Inject</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">static</span> org.<span style="color: #006633;">apache</span>.<span style="color: #006633;">commons</span>.<span style="color: #006633;">lang3</span>.<span style="color: #006633;">StringUtils</span>.<span style="color: #006633;">isNotEmpty</span><span style="color: #339933;">;</span><br />
<br />
@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LayoutColumn <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> RENDER_LAYOUT_AS_PROP <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;renderLayoutAs&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Style</span> currentStyle<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @PostConstruct<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> renderLayoutAs <span style="color: #339933;">=</span> currentStyle.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>RENDER_LAYOUT_AS_PROP, <span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isNotEmpty<span style="color: #009900;">&#40;</span>renderLayoutAs<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>renderLayoutAs<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;oneColumn&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;twoColumns&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;threeColumns&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">case</span> <span style="color: #0000ff;">&quot;fourColumns&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">default</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Default case&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-access-design-dialogue-properties-in-sling-model">How to access Design Dialogue Properties in Sling Model</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-access-design-dialogue-properties-in-sling-model/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Rich Text Editor rendering aria-labels</title>
		<link>https://sourcedcode.com/blog/aem/aem-rich-text-editor-rendering-aria-labels</link>
					<comments>https://sourcedcode.com/blog/aem/aem-rich-text-editor-rendering-aria-labels#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 14 May 2023 01:08:24 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4878</guid>

					<description><![CDATA[<p>You have written some custom JavaScript for the AEM Core Text Component, core/wcm/components/text/v2/text, which allows content producers to configure the HTML attribute &#8220;aria-label&#8221; to anchor &#8220;a&#8221; tags. When the page is being rendered on the page, the &#8220;aria-label&#8221; for the links, &#8220;a&#8221; tags, are not visible. You as a developer check crx/de and you do [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-rich-text-editor-rendering-aria-labels">AEM Rich Text Editor rendering aria-labels</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>You have written some custom JavaScript for the AEM Core Text Component, core/wcm/components/text/v2/text, which allows content producers to configure the HTML attribute &#8220;aria-label&#8221; to anchor &#8220;a&#8221; tags. When the page is being rendered on the page, the &#8220;aria-label&#8221; for the links, &#8220;a&#8221; tags, are not visible. You as a developer check crx/de and you do actually see the configured text component contains &#8220;aria-label&#8221; in each of every link.</p>
<p>Why is the aria-label for the AEM Core Text Component not rendering as expected?<br />
For rendering links that contain the &#8220;aria-label&#8221; attribute, AEM refers to AEM&#8217;s XSS (Cross-Site Scripting) protection. This protection mechanism, exclusive to AEM, effectively prevents attackers from injecting malicious code into web pages that are viewed by other users. AEM&#8217;s XSS protection is built upon the trusted AntiSamy Java library, which is provided by OWASP (Open Web Application Security Project).</p>
<p>During the rendering process in AEM, if certain tags are not included in the whitelist, they will be stripped off. This means that any tags not explicitly permitted by the XSS protection configuration will be removed when the web pages are rendered. By enforcing this restriction, AEM ensures that only authorized and safe tags are displayed, significantly reducing the potential risk of XSS vulnerabilities.</p>
<p>In this article, we will configure AEM to allow the &#8220;aria-label&#8221; HTML attribute, so your text component&#8217;s links are rendering as expected. This article does not provide the JavaScript solution for how to add capabilities to the AEM Core Text Component for the &#8220;aria-label&#8221; HTML attribute.</p>
<hr class="spacer-large" />
<h3>Developer steps to enable and allow the AEM Core Text Component  to render &#8220;aria-label&#8221; on the page.</h3>
<ol>
<li>Login to AEM</li>
<li>Visit http://localhost:4502/crx/de/index.jsp#/libs/cq/xssprotection/config.xml</li>
<li>Overlay the XSS protection configuration by copying /libs/cq/xssprotection into /apps/cq/xssprotection (and all it&#8217;s children)</li>
<li>Delete the /apps/cq/xssprotection/rep:policy</li>
<li>From crx/DE you can edit the file /apps/cq/xssprotection/config.xml</li>
<li>On your keyboard, hit &#8220;ctrl + f&#8221; to find &lt;tag name=&#8221;a&#8221; action=&#8221;validate&#8221;&gt;</li>
<li>This is an XML file, so find the end of the closing tag &lt;/tag&gt;</li>
<li>Insert this line of code:
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">&lt;</span>attribute name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;aria-label&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;</span>regexp<span style="color: #339933;">-</span>list<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>regexp name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;anything&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>regexp<span style="color: #339933;">-</span>list<span style="color: #339933;">&gt;</span><br />
&nbsp;<span style="color: #339933;">&lt;/</span>attribute<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p><a href="https://sourcedcode.com/wp-content/uploads/2023/06/aria-label-configxml.png"><img fetchpriority="high" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2023/06/aria-label-configxml.png" alt="Screenshot of config.xml being updated: adding block of code before closing &lt;/tag&gt; element" width="1247" height="728" class="alignnone size-full wp-image-4884" /></a>
</li>
<li>Done</li>
<li>Now test out the Text Component, and expect the aria-labels to render as expected!</li>
<li>Next, you would want to copy the /apps/cq/xssprotection into your code base, so you can deploy the xss configuration into difference environments of AEM automatically.</li>
</ol>
<hr class="spacer-large" />
<div class="mention-block">
<strong>Very Important!</strong><br />
<strong>AEMaaCS</strong>: From time to time, if your AEM website is running on AEMaaCS, when there are updates, you need to ensure that you run through every step from step 1. This ensures that you are inheriting new updated Adobe recommendations for XSS protection.</p>
<p><strong>AEM onPrem</strong>: From time to time, if you have upgraded your AEM environment with a new service pack, you need to ensure that you run through every step from step 1. This ensures that you are inheriting new updated Adobe recommendations for XSS protection.
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-rich-text-editor-rendering-aria-labels">AEM Rich Text Editor rendering aria-labels</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-rich-text-editor-rendering-aria-labels/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Query Builder Examples with Content Fragments</title>
		<link>https://sourcedcode.com/blog/aem/aem-query-builder-examples-with-content-fragments</link>
					<comments>https://sourcedcode.com/blog/aem/aem-query-builder-examples-with-content-fragments#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Tue, 02 May 2023 03:34:23 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Content Fragment]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4804</guid>

					<description><![CDATA[<p>In this article, I will share some example AEM Query Builder API Search Queries that queries for Content Fragments. 1. Find all Content Fragments with Content Fragment Model 123456type=dam:Asset path=/content/dam/sourcedcode boolproperty=jcr:content/contentFragment boolproperty.value=true property=jcr:content/data/cq:model property.value=/conf/sourcedcode/settings/dam/cfm/models/model1 http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1 2. Find all Content Fragments with Content Fragment Model &#038; Property 12345678type=dam:Asset path=/content/dam/sourcedcode boolproperty=jcr:content/contentFragment boolproperty.value=true 1_property=jcr:content/data/cq:model 1_property_1.value=/conf/sourcedcode/settings/dam/cfm/models/model1 2_property=jcr:content/data/master/title 2_property.value=example http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=path%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0A1_property%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0A1_property_1.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0A2_property%3Djcr%3Acontent%2Fdata%2Fmaster%2Ftitle%0D%0A2_property.value%3Dexample [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-query-builder-examples-with-content-fragments">AEM Query Builder Examples with Content Fragments</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, I will share some example AEM Query Builder API Search Queries that queries for Content Fragments.</p>
<hr class="spacer-large" />
<h3>1. Find all Content Fragments with Content Fragment Model</h3>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>dam<span style="color: #339933;">:</span>Asset<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>sourcedcode<br />
boolproperty<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>contentFragment<br />
boolproperty.<span style="color: #006633;">value</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><br />
property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>model<br />
property.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>sourcedcode<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>cfm<span style="color: #339933;">/</span>models<span style="color: #339933;">/</span>model1</div></td></tr></tbody></table></div>
<p><a href="http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1" rel="noopener" target="_blank">http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1</a></p>
<hr class="spacer-large" />
<h3>2. Find all Content Fragments with Content Fragment Model &#038; Property</h3>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>dam<span style="color: #339933;">:</span>Asset<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>sourcedcode<br />
boolproperty<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>contentFragment<br />
boolproperty.<span style="color: #006633;">value</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><br />
<span style="color: #cc66cc;">1</span>_property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>model<br />
<span style="color: #cc66cc;">1</span>_property_1.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>sourcedcode<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>cfm<span style="color: #339933;">/</span>models<span style="color: #339933;">/</span>model1<br />
<span style="color: #cc66cc;">2</span>_property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>master<span style="color: #339933;">/</span>title<br />
<span style="color: #cc66cc;">2</span>_property.<span style="color: #006633;">value</span><span style="color: #339933;">=</span>example</div></td></tr></tbody></table></div>
<p><a href="http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=path%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0A1_property%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0A1_property_1.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0A2_property%3Djcr%3Acontent%2Fdata%2Fmaster%2Ftitle%0D%0A2_property.value%3Dexample" rel="noopener" target="_blank">http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;query=path%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0A1_property%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0A1_property_1.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0A2_property%3Djcr%3Acontent%2Fdata%2Fmaster%2Ftitle%0D%0A2_property.value%3Dexample</a></p>
<hr class="spacer-large" />
<h3>4. Find all Content Fragments with Content Fragment Model &#038; Full Text Search</h3>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>dam<span style="color: #339933;">:</span>Asset<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>dam<br />
boolproperty<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>contentFragment<br />
boolproperty.<span style="color: #006633;">value</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><br />
property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>model<br />
property.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>wknd<span style="color: #339933;">-</span>shared<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>cfm<span style="color: #339933;">/</span>models<span style="color: #339933;">/</span>adventure<br />
fulltext<span style="color: #339933;">=</span>a<br />
fulltext.<span style="color: #006633;">relPath</span><span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>master</div></td></tr></tbody></table></div>
<p><a href="http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;facets=on&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fwknd-shared%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fadventure%0D%0Afulltext%3Da%0D%0Afulltext.relPath%3Djcr%3Acontent%2Fdata%2Fmaster%0D%0A" rel="noopener" target="_blank">http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;facets=on&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fwknd-shared%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fadventure%0D%0Afulltext%3Da%0D%0Afulltext.relPath%3Djcr%3Acontent%2Fdata%2Fmaster%0D%0A</a></p>
<hr class="spacer-large" />
<h3>4. Find all Content Fragments &#038; Full Text Search</h3>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>dam<span style="color: #339933;">:</span>Asset<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>sourcedcode<br />
boolproperty<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>contentFragment<br />
boolproperty.<span style="color: #006633;">value</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">true</span><br />
property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>data<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>model<br />
property.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>sourcedcode<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>dam<span style="color: #339933;">/</span>cfm<span style="color: #339933;">/</span>models<span style="color: #339933;">/</span>model1<br />
fulltext<span style="color: #339933;">=</span>full text</div></td></tr></tbody></table></div>
<p><a href="http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;facets=on&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0Afulltext%3Dfull+text">http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&#038;facets=on&#038;query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0Afulltext%3Dfull+text</a></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-query-builder-examples-with-content-fragments">AEM Query Builder Examples with Content Fragments</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-query-builder-examples-with-content-fragments/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>@SlingServletPaths Example Code in AEM</title>
		<link>https://sourcedcode.com/blog/aem/slingservletpaths-example-code-in-aem</link>
					<comments>https://sourcedcode.com/blog/aem/slingservletpaths-example-code-in-aem#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Tue, 02 May 2023 03:01:49 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4796</guid>

					<description><![CDATA[<p>This is a quick reference to example code, which will show you how to use the most base instantiation of @SlingServletPaths. The output is a simple JSON response with application/JSON, 200 OK, and response body = { &#8220;property1&#8221;: &#8220;value1&#8221; }. Quick note: it&#8217;s not recommended to use @SlingServletPaths. Check out the caveats when implementing servlets [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/slingservletpaths-example-code-in-aem">@SlingServletPaths Example Code in AEM</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is a quick reference to example code, which will show you how to use the most base instantiation of @SlingServletPaths. The output is a simple JSON response with application/JSON, 200 OK, and response body = { &#8220;property1&#8221;: &#8220;value1&#8221; }.</p>
<div class="mention-block">
<strong>Quick note:</strong><br />
it&#8217;s not recommended to use @SlingServletPaths. Check out the caveats when implementing servlets with path, @SlingServletPaths, <a href="https://sourcedcode.com/blog/aem/registering-slingservletpaths-component-property-type">https://sourcedcode.com/blog/aem/registering-slingservletpaths-component-property-type</a>
</div>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.core.servlets</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.gson.JsonObject</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.servlets.SlingSafeMethodsServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.servlets.annotations.SlingServletPaths</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Component</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.Servlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<br />
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span>service <span style="color: #339933;">=</span> Servlet.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
@SlingServletPaths<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/bin/example&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FindContentFragmentServlet <span style="color: #000000; font-weight: bold;">extends</span> SlingSafeMethodsServlet <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JsonObject jo <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JsonObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jo.<span style="color: #006633;">addProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;property1&quot;</span>, <span style="color: #0000ff;">&quot;value1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>jo.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span>SlingHttpServletResponse.<span style="color: #006633;">SC_OK</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<hr class="spacer-larger" />
<h3>Example of Servlet Being Called</h3>
<p><strong>Test:</strong> When I call http://localhost:4502/bin/example, I expect to see a JSON response with application/JSON, 200 OK, and response body = { &#8220;property1&#8221;: &#8220;value1&#8221; }. The example shows that the tests are passing.</p>
<p><a href="https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example.png" alt="" width="1974" height="1534" class="alignnone size-full wp-image-4798" srcset="https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example.png 1974w, https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example-300x233.png 300w, https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example-1024x796.png 1024w, https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example-768x597.png 768w, https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example-1536x1194.png 1536w, https://sourcedcode.com/wp-content/uploads/2023/05/SlingServletPaths-example-600x466.png 600w" sizes="(max-width: 1974px) 100vw, 1974px" /></a></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/slingservletpaths-example-code-in-aem">@SlingServletPaths Example Code in AEM</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/slingservletpaths-example-code-in-aem/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Touch UI (Granite UI) Tabs: Example Code</title>
		<link>https://sourcedcode.com/blog/aem/aem-touch-ui-granite-ui-tabs-example-code</link>
					<comments>https://sourcedcode.com/blog/aem/aem-touch-ui-granite-ui-tabs-example-code#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Fri, 28 Apr 2023 23:31:30 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Touch UI]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=4775</guid>

					<description><![CDATA[<p>Almost all components require developers to put together the Touch UI experience with tabs as the base of their components. It&#8217;s a simple XML code configuration, however, sometimes finding the reference isn&#8217;t that easy to find online. This article is just a simple reference article where I share the configuration as XML, so it can [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-touch-ui-granite-ui-tabs-example-code">AEM Touch UI (Granite UI) Tabs: Example Code</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Almost all components require developers to put together the Touch UI experience with tabs as the base of their components. It&#8217;s a simple XML code configuration, however, sometimes finding the reference isn&#8217;t that easy to find online. This article is just a simple reference article where I share the configuration as XML, so it can be copied and pasted + ready to go at a rapid pace.</p>
<div class="mention-block">
This code was extracted from Adobe&#8217;s code, the WCM Core Components v2.22.6 Latest; so no surprises.
</div>
<p><a href="#code-snippet">Jump to Code Snippet</a></p>
<hr class="spacer-large"/>
<h3>Granite UI (Touch UI) Rendered as</h3>
<p>This is a screenshot of how a very basic Touch UI would look like for author&#8217;s when the author double clicks on the component to make change&#8217;s to it.<br />
<a href="https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2.png"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2.png" alt="Touch UI Granite UI Code Configuration Example - Tabs" width="2416" height="1448" class="alignnone size-full wp-image-4777" srcset="https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2.png 2416w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-300x180.png 300w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-1024x614.png 1024w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-768x460.png 768w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-1536x921.png 1536w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-2048x1227.png 2048w, https://sourcedcode.com/wp-content/uploads/2023/04/example-component-tab-1-tab-2-600x360.png 600w" sizes="(max-width: 2416px) 100vw, 2416px" /></a></p>
<p><a href="#code-snippet">Jump to Code Snippet</a></p>
<hr class="spacer-large"/>
<h3 id="code-snippet">Code Snippet</h3>
<p>The solution below includes an example with the &#8220;styletab&#8221; which is an out-of-the-box feature for the AEM Style System. You can copy and paste this snippet into your .content.xml, like _cq_dialog/.content.xml:</p>
<div class="code-1250">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #339933;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">?&gt;</span><br />
<span style="color: #339933;">&lt;</span>jcr<span style="color: #339933;">:</span>root xmlns<span style="color: #339933;">:</span>sling<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://sling.apache.org/jcr/sling/1.0&quot;</span> xmlns<span style="color: #339933;">:</span>granite<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.adobe.com/jcr/granite/1.0&quot;</span> xmlns<span style="color: #339933;">:</span>cq<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.day.com/jcr/cq/1.0&quot;</span> xmlns<span style="color: #339933;">:</span>jcr<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.jcp.org/jcr/1.0&quot;</span> xmlns<span style="color: #339933;">:</span>nt<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.jcp.org/jcr/nt/1.0&quot;</span><br />
&nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; jcr<span style="color: #339933;">:</span>title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Component&quot;</span><br />
&nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cq/gui/components/authoring/dialog&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;</span>content<br />
&nbsp; &nbsp; &nbsp; &nbsp; granite<span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;cmp-button__editor&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>tabs<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/tabs&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maximized<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>tab1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tab 1&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>columns<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/fixedcolumns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>column<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>exampleinputfield1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldDescription<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example input 1 field can be placed here&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Input Field 1&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;./exampleinputfield1&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>examplepathfield1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/form/pathfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldDescription<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example path field 1 field can be placed here&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Path Field 1&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;./examplepathfield1&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootPath<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/content&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>column<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>columns<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>tab1<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>tab2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Tab 2&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>columns<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/fixedcolumns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Boolean}true&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>column<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/container&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>items jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>exampleinputfield2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldDescription<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example input 1 field can be placed here&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Input Field 2&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;./exampleinputfield2&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>examplepathfield2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/form/pathfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldDescription<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example path field 2 field can be placed here&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldLabel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Path Field 2&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;./examplepathfield2&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rootPath<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/content&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>column<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>columns<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>tab2<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>cq<span style="color: #339933;">:</span>styles<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jcr<span style="color: #339933;">:</span>primaryType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sling<span style="color: #339933;">:</span>resourceType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;granite/ui/components/coral/foundation/include&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; path<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/mnt/overlay/cq/gui/components/authoring/dialog/style/tab_edit/styletab&quot;</span><span style="color: #339933;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>tabs<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>items<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;/</span>content<span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;/</span>jcr<span style="color: #339933;">:</span>root<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
</div>
<hr class="spacer-large"/>
<h3>Extras</h3>
<p>If you would like to enable your component for the AEM Style System, click here, <a href="https://sourcedcode.com/blog/aem/how-to-enable-aem-style-system-configuration-for-components">How to Enable AEM Style System Configuration for Components</a>.</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-touch-ui-granite-ui-tabs-example-code">AEM Touch UI (Granite UI) Tabs: Example Code</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-touch-ui-granite-ui-tabs-example-code/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Pass Data Parameters to Sling Modal from Sightly HTL Component</title>
		<link>https://sourcedcode.com/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component</link>
					<comments>https://sourcedcode.com/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sat, 23 Oct 2021 04:52:31 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Sling Models]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=2971</guid>

					<description><![CDATA[<p>You can pass data parameters from Sightly HTL component to the Sling Model backend by request attributes. For implementation, utilising the org.apache.sling.models.annotations.Model, we will add required options parameter, adaptable, with the value of SlingHttpServletRequest.class. Next, we can utilize the annotation, org.apache.sling.models.annotations.injectorspecific.RequestAttribute (@RequestAttribute), which will find the matching name of the attribute that is being passed [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component">How to Pass Data Parameters to Sling Modal from Sightly HTL Component</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>You can pass data parameters from Sightly HTL component to the Sling Model backend by <b>request attributes</b>. For implementation, utilising the org.apache.sling.models.annotations.Model, we will add required options parameter, adaptable, with the value of SlingHttpServletRequest.class. Next, we can utilize the annotation, org.apache.sling.models.annotations.injectorspecific.RequestAttribute (@RequestAttribute), which will find the matching name of the attribute that is being passed from the Sightly HTL component. </p>
<div class="mention-block">
As developers. We learn best by example, See the example below of an example of Sightly HTL component referencing to the Sling Model backend. </p>
<p>I created the code below to showcase a real production scenario. After a selection from the TouchUI pathfinder, we are given a path of /content/sourcedcode/en/home. From sightly, we must append a .html, but when the path was not chosen with the TouchUI pathfinder with the value set manually to https://sourcedcode.com, no .html extensions should be added.</p>
<p>This example below showcases how we can logically insert the .html extensions based on conditions.
</p></div>
<h3>Sightly HTL</h3>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">// expect /content/sourcedcode/home.html<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;title-text&quot;</span> data-sly-use.linkResolve<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${'com.sourcedcode.core.utils.use.LinkResolve' @ href='/content/sourcedcode/home'}&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.href}&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.target}&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;noopener&quot;</span>&gt;</span><br />
&nbsp; &nbsp; ${linkResolve.href}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span><br />
// expect https://sourcedcode.com<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;title-text&quot;</span> data-sly-use.linkResolve<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${'com.sourcedcode.core.utils.use.LinkResolve' @ href='https://sourcedcode.com'}&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.href}&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.target}&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;noopener&quot;</span>&gt;</span><br />
&nbsp; &nbsp; ${linkResolve.href}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span><br />
// expect https://sourcedcode.com<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> data-sly-use.linkResolve<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${'com.sourcedcode.core.models.LinkResolve' @</span><br />
<span style="color: #009900;"> &nbsp; &nbsp;href=properties.href,</span><br />
<span style="color: #009900;"> &nbsp; &nbsp;target=properties.target}&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.href}&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${linkResolve.target}&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;noopener&quot;</span>&gt;</span><br />
&nbsp; &nbsp; ${linkResolve.href}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span></div></td></tr></tbody></table></div>
<h3>Sling Model Class : LinkResolve.class</h3>
<div class="code-large">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.sourcedcode.core.models</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Default</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Model</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Optional</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.injectorspecific.RequestAttribute</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.annotation.PostConstruct</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.regex.Pattern</span><span style="color: #339933;">;</span><br />
<br />
@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> LinkResolve <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; @RequestAttribute<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> href<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @Optional<br />
&nbsp; &nbsp; @<span style="color: #000000; font-weight: bold;">Default</span><span style="color: #009900;">&#40;</span>values<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;_self&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; @RequestAttribute<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> target<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @PostConstruct<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>href <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">||</span> href.<span style="color: #006633;">isEmpty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> isLinkExternal <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;^https?://.*&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>href<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> isLinkInternalAsset <span style="color: #339933;">=</span> Pattern.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.*<span style="color: #000099; font-weight: bold;">\\</span>.(<span style="color: #000099; font-weight: bold;">\\</span>w){1,5}$&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">matcher</span><span style="color: #009900;">&#40;</span>href<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">matches</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>isLinkExternal <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>isLinkInternalAsset<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; href <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>href.<span style="color: #006633;">endsWith</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.html&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> href.<span style="color: #006633;">contains</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;?&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> href <span style="color: #339933;">:</span> href <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;.html&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getHref<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> href<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTarget<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> target<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component">How to Pass Data Parameters to Sling Modal from Sightly HTL Component</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AEM inheritedpageproperties with Sightly, JSP, OSGI Bundle</title>
		<link>https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle</link>
					<comments>https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 20 Sep 2020 17:18:31 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[OSGI]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=2232</guid>

					<description><![CDATA[<p>inheritedpageproperties helps you retrieve a parent property from parent pages. Inherited page properties utilises com.day.cq.commons.inherit.HierarchyNodeInheritanceValueMap, where the search is made on the page hierarchy, upwards; searching children of the page nodes (components) are not included. Inherited page properties can be retrieved in multiple ways, where this article will only focus on 3 ways. In this [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle">AEM inheritedpageproperties with Sightly, JSP, OSGI Bundle</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>inheritedpageproperties helps you retrieve a parent property from parent pages. Inherited page properties utilises <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html" title="https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html" rel="noopener nofollow noreferrer" target="_blank">com.day.cq.commons.inherit.HierarchyNodeInheritanceValueMap</a>, where the search is made on the page hierarchy, upwards; searching children of the page nodes (components) are not included. Inherited page properties can be retrieved in multiple ways, where this article will only focus on 3 ways.</p>
<p>In this article, we will go through the 3 different ways in how we can retrieve inherited page properties.</p>
<ol>
<li><a href="#inheritedPageProperties-how-it-works">How does this work?</a></li>
<li><a href="#inheritedPageProperties-with-sightly">inheritedPageProperties with Sightly</a></li>
<li><a href="#inheritedPageProperties-with-jsp">inheritedPageProperties with JSP</a></li>
<li><a href="#inheritedPageProperties-with-java-backend">inheritedPageProperties with OSGI Bundle, Java Backend</a></li>
</ol>
<hr class="spacer-large"/>
<h2 id="inheritedPageProperties-how-it-works">How does this work?</h2>
<p>An InheritanceValueMap for a given Resource that will inherit values from ancestral pages.<br />
For example, given: /content/parent/page/jcr:content/footer/image/@width, the HierarchyNodeInheritanceValueMap will search for a footer/image/@width property in:</p>
<p><strong>look up one:</strong> /content/parent/<strong>currentPage</strong>/jcr:content/footer/image/@width<br />
<strong>look up two:</strong> /content/parent/jcr:content/footer/image/@width<br />
<strong>look up three:</strong> /content/jcr:content/footer/image/@width</p>
<hr class="spacer-large"/>
<h2 id="inheritedPageProperties-with-sightly">1. inheritedPageProperties with Sightly</h2>
<p>Sightly offers a plethora of <a href="/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl" rel="noopener noreferrer" target="_blank">AEM Global objects</a>, and one of them notably is the &#8220;inheritedPageProperties&#8221;. Utilising the inheritedPageProperties global object, we can use dot or square bracket notation to access the interited page property value.</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">${inheritedPageProperties.myCustomProperty}<br />
${inheritedPageProperties['myCustomProperty']}<br />
${inheritedPageProperties.jcr:title}<br />
${inheritedPageProperties['jcr:title']}</div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="4202452438"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h2 id="inheritedPageProperties-with-jsp">2. inheritedPageProperties with JSP</h2>
<p>Utilising the JSP include, /libs/foundation/global.jsp (purpose of retreiving the currentPage AEM global object), we can make use of the HierarchyNodeInheritanceValueMap.class, and currentPage resource to initialise the InheritanceValueMap.class object. Next, calling the method <a href="https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html" rel="noopener noreferrer" target="_blank">getInherited(String name, Class&lt;T&gt; type)</a>, we are able to get the inherited page property.</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">&lt;%@include file<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/libs/foundation/global.jsp&quot;</span>%&gt;<br />
&lt;%@ page import<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;com.day.cq.commons.inherit.InheritanceValueMap&quot;</span> %&gt;<br />
&lt;%@ page import<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;com.day.cq.commons.inherit.HierarchyNodeInheritanceValueMap&quot;</span> %&gt;<br />
<br />
&lt;%<br />
&nbsp; &nbsp; InheritanceValueMap ivm <span style="color: #66cc66;">=</span> new HierarchyNodeInheritanceValueMap<span style="color: #66cc66;">&#40;</span>currentPage.getContentResource<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; String inheritedValueMyCustomProperty <span style="color: #66cc66;">=</span> ivm.getInherited<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;myCustomerProperty&quot;</span>, String.<span style="color: #000066;">class</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; String inheritedValueJcrTitle <span style="color: #66cc66;">=</span> ivm.getInherited<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;jcr:title&quot;</span>, String.<span style="color: #000066;">class</span><span style="color: #66cc66;">&#41;</span>;<br />
%&gt;<br />
inheritedValueMyCustomProperty <span style="color: #66cc66;">=</span> &lt;%<span style="color: #66cc66;">=</span> inheritedValueMyCustomProperty %&gt;<br />
inheritedValueJcrTitle <span style="color: #66cc66;">=</span> &lt;%<span style="color: #66cc66;">=</span> inheritedValueJcrTitle %&gt;</div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h2 id="inheritedPageProperties-with-java-backend">3. inheritedPageProperties with OSGI Bundle, Java Backend</h2>
<p>Similar to the JSP implementation above, we can make use of the HierarchyNodeInheritanceValueMap.class, and currentPage resource to initialise the InheritanceValueMap.class object. Next, calling the method <a href="https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/inherit/HierarchyNodeInheritanceValueMap.html" rel="noopener noreferrer" target="_blank">getInherited(String name, Class&lt;T&gt; type)</a>, we are able to get the inherited page property.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.commons.inherit.InheritanceValueMap</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.commons.inherit.HierarchyNodeInheritanceValueMap</span><span style="color: #339933;">;</span><br />
<br />
@ScriptVariable <br />
<span style="color: #000000; font-weight: bold;">private</span> Page currentPage<span style="color: #339933;">;</span><br />
...<br />
<span style="color: #006633;">InheritanceValueMap</span> ivm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HierarchyNodeInheritanceValueMap<span style="color: #009900;">&#40;</span>currentPage.<span style="color: #006633;">getContentResource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #003399;">String</span> inheritedValueMyCustomProperty <span style="color: #339933;">=</span> ivm.<span style="color: #006633;">getInherited</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;myCustomerProperty&quot;</span>, <span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #003399;">String</span> inheritedValueJcrTitle <span style="color: #339933;">=</span> ivm.<span style="color: #006633;">getInherited</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jcr:title&quot;</span>, <span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle">AEM inheritedpageproperties with Sightly, JSP, OSGI Bundle</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>How many times is an AEM Component used in the JCR?</title>
		<link>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr</link>
					<comments>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Thu, 11 Jun 2020 23:09:16 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Author]]></category>
		<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1870</guid>

					<description><![CDATA[<p>Can we detect and remove unused components from our codebase? Is this AEM component being used at all? How many times is my component used within my running AEM instance? These are the common questions we have when we are trying to figure out the number of use and the node-paths of the targeted searched [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr">How many times is an AEM Component used in the JCR?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Can we detect and remove unused components from our codebase? Is this AEM component being used at all? How many times is my component used within my running AEM instance? </p>
<p>These are the common questions we have when we are trying to figure out the number of use and the node-paths of the targeted searched component within the Java content repository, known as &#8220;JCR&#8221;. In this article, you will discover one of the quickest techniques used to retrieve the total number of uses and node-paths of a component within the JCR by using the Query Builder API, <a href="#query-debugger-tool">query debugger tool</a>. </p>
<p>If you don&#8217;t have certain user priveledges within your AEM instance, there&#8217;s another way to find out the usage of your component(s), <a href="#components-console">Components Console</a>; however, the Components Console is restricted in a sense where the component search results-list only display pages of a given component and does not provide a total number of how many pages are returned from the search.</p>
<div class="mention-block">
<strong>Quick Links</strong></p>
<ol>
<li><a href="#query-debugger-tool">Component Search by the Query Builder API, Query Builder Debugger Tool</a></li>
<li><a href="#components-console">Component Search by the Components Console</a></li>
<li><a href="#search-by-cq-template"><strong>Extra</strong>: How many pages are using an AEM template?</a></li>
<li><a href="#search-for-all-nodes-with-the-existing-property"><strong>Extra</strong>: How to search for all nodes in AEM, JCR, with an existing property?</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h2 id="query-debugger-tool">1. Component Search by the Query Builder API, Query Builder Debugger Tool</h3>
<p>The AEM Query Builder is an API which can be used to search for nodes in JCR. Well defined &#8220;Predicates&#8221; are typically created from using the Query Builder Debugging Tool, as this tool serves instant search results within the UI.</p>
<p><strong>Step 1</strong>: With your running AEM instance, visit <a href="http://localhost:4502/libs/cq/search/content/querydebug.html" rel="noopener noreferrer" target="_blank">http://localhost:4502/libs/cq/search/content/querydebug.html</a>.</p>
<p><strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg">2</a></strong>: Paste in the search query below &#038; hit search; <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg">view screenshot</a>.<br />
<em style="color: red; font-size:12px;">Replace with your component&#8217;s path: weretail/components/content/heroimage</em><br />
<em style="color: blue; font-size:12px;">Note!: sometimes the descendant path must be more nested, so /content/we-retail/gb/en</em></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
<span style="color: #cc66cc;">1</span>_property<span style="color: #339933;">=</span>sling<span style="color: #339933;">:</span>resourceType<br />
<span style="color: #cc66cc;">1</span>_property.<span style="color: #006633;">value</span><span style="color: #339933;">=</span>weretail<span style="color: #339933;">/</span>components<span style="color: #339933;">/</span>content<span style="color: #339933;">/</span>heroimage</div></td></tr></tbody></table></div>
<p><i>This query searches for all types of nodes with the sling:resourceType equals to the value, weretail/components/content/heroimage, and where the path is descendant from /content/we-retail; to learn more about the Query builder API and queries, <a href="https://docs.adobe.com/content/help/en/experience-manager-64/developing/platform/query-builder/querybuilder-api.html" rel="noopener noreferrer" target="_blank">click here (Adobe Documentation)</a></i></p>
<p><strong>Step 3</strong>: Review the results.<br />
<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-300x128.jpg" alt="Query Builder Debugger" width="300" height="128" class="alignnone size-medium wp-image-1889" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-300x128.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-1024x436.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-768x327.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component-600x255.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-image-query-builder-find-component.jpg 1300w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<div id="search-by-cq-template" class="mention-block">
<strong>Extra:</strong></p>
<h2 style="font-size: 16px;">Find out How many pages are using an AEM template?</h2>
<p>The query below will find all cq:Page nodes in the JCR, which cq:template equals to /conf/we-retail/settings/wcm/templates/hero-page; under the content path /content/we-retail. The search results will show you the absolute node page path of whom has the matched property and value set.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">type<span style="color: #339933;">=</span>cq<span style="color: #339933;">:</span>Page<br />
path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
<span style="color: #cc66cc;">1</span>_property<span style="color: #339933;">=</span>jcr<span style="color: #339933;">:</span>content<span style="color: #339933;">/</span>cq<span style="color: #339933;">:</span>template<br />
<span style="color: #cc66cc;">1</span>_property.<span style="color: #006633;">value</span><span style="color: #339933;">=/</span>conf<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<span style="color: #339933;">/</span>settings<span style="color: #339933;">/</span>wcm<span style="color: #339933;">/</span>templates<span style="color: #339933;">/</span>hero<span style="color: #339933;">-</span>page</div></td></tr></tbody></table></div>
<p>Ensuring that the &#8220;path&#8221; property is set is important, because you would not want to excessively triverse through the entire JCR; which will exhaust the AEM environment performance.
</p></div>
<div id="search-for-all-nodes-with-the-existing-property" class="mention-block">
<strong>Extra:</strong></p>
<h2 style="font-size: 16px;">How to search for all nodes in AEM, JCR, with an existing property?</h2>
<p>The query below will search all nodes in the JCR, which &#8220;myCustomProperty&#8221; exists; under the content path /content/we-retail. The search results will show you the absolute node page path of whom has the matched property and value set.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">path<span style="color: #339933;">=/</span>content<span style="color: #339933;">/</span>we<span style="color: #339933;">-</span>retail<br />
property<span style="color: #339933;">=</span>myCustomProperty<br />
property.<span style="color: #006633;">operation</span><span style="color: #339933;">=</span>exists</div></td></tr></tbody></table></div>
<p>Ensuring that the &#8220;path&#8221; property is set is important, because you would not want to excessively triverse through the entire JCR; which will exhaust the AEM environment performance.
</p></div>
<hr class="spacer-large"/>
<h2 id="components-console">2. Component Search by the Components Console</h3>
<p>This out of the box Components Console, CC, is available from AEM 6.2+ right under Tools -> General -> Components. The CC displays search results in a form of pages where the component is being used; rather than each node from the example above. This console is accessible to authors so that even they can check for which pages use the searched component.</p>
<p><strong>Step 1</strong>: Within your running AEM instance, visit <a href="http://localhost:4502/libs/wcm/core/content/sites/components.html">http://localhost:4502/libs/wcm/core/content/sites/components.html</a>.</p>
<p><strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg"><a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg">2</a></strong>: Search for a component. Insert your search criteria with either by &#8220;keyword&#8221;, &#8220;component path&#8221;, or &#8220;component group&#8221;. On every change of the search criteria, you should see results in a list format on the right hand side of the search left side bar.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg">3</a></strong>: Click on the targeted component, and you will be redirected to the details page.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg">4</a></strong>: From the details page, click on &#8220;live usage&#8221;, and a results-list of pages will be displayed, where the targeted component can be found.<br />
<strong>Step <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg">5</a></strong>: From the results-list, clicking on a link will open the page&#8217;s editor.</p>
<table>
<tr>
<td align="center" width="50%" style="border: none;">Components Console &#8211; Steps 2 &#038; 3<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-300x164.jpg" alt="Components Console - Steps 2 &#038; 3" width="300" height="164" class="alignnone size-medium wp-image-1913" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-300x164.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-1024x559.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-768x419.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a-600x328.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-a.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
<td align="center" width="50%" style="border: none;">Components Console &#8211; Steps 4 &#038; 5 <a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-300x164.jpg" alt="Components Console - Steps 4 &#038; 5" width="300" height="164" class="alignnone size-medium wp-image-1914" srcset="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-300x164.jpg 300w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-1024x559.jpg 1024w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-768x419.jpg 768w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b-600x328.jpg 600w, https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-component-console-steps-b.jpg 1200w" sizes="(max-width: 300px) 100vw, 300px" /></a></td>
</tr>
</table>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr">How many times is an AEM Component used in the JCR?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide</title>
		<link>https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide</link>
					<comments>https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Wed, 03 Jun 2020 17:52:00 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[OSGI]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1643</guid>

					<description><![CDATA[<p>When defining any OSGI component&#8217;s configuration its standard practice to use Declarative Services; these configurations can be edited in the OSGI Apache Felix Console. This can be done by creating a class interface with the annotated @ObjectClassDefinition, which includes a determined list of rules as @AttributeDefinition items. The @AttributeDefinition defines the supporting configuration for a [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide">OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>When defining any OSGI component&#8217;s configuration its standard practice to use Declarative Services; these configurations can be edited in the OSGI Apache Felix Console. This can be done by creating a class interface with the annotated @ObjectClassDefinition, which includes a determined list of rules as @AttributeDefinition items.</p>
<p>The @AttributeDefinition defines the supporting configuration for a given OSGI component&#8217;s configuration. It allows you to set data types and default values for each given configuration. When an admin user interacts with the Felix console, how the @AttributeDefinition is defined will determine the look and feel of each of the input fields are presented.</p>
<div class="mention-block">
<p><strong>Quick Links</strong></p>
<ol>
<li><a href="#essential-parameters-explained">@AttributeDefinition Essential Parameters Explained</a></li>
<li><a href="#attribute-types">Attribute Types &#8211; References</a></li>
<li><a href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-code-examples" target="_blank" rel="noopener noreferrer"><span class="code-highlight-primary">How to Enable Configuration for OSGI Components</span></a></li>
</ol>
<hr />
<p><strong>Attribute Types &#8211; References</strong></p>
<ol>
<li><a href="#attribute-type-string">String Attribute Type</a></li>
<li><a href="#attribute-type-string-array">String[] Attribute Type</a></li>
<li><a href="#attribute-type-long">Long Attribute Type</a></li>
<li><a href="#attribute-type-int">int Attribute Type</a></li>
<li><a href="#attribute-type-short">Short Attribute Type</a></li>
<li><a href="#attribute-type-char">Char Attribute Type</a></li>
<li><a href="#attribute-type-byte">byte Attribute Type</a></li>
<li><a href="#attribute-type-double">Double Attribute Type</a></li>
<li><a href="#attribute-type-float">Float Attribute Type</a></li>
<li><a href="#attribute-type-boolean">Boolean Attribute Type</a></li>
<li><a href="#attribute-type-password">Password Attribute Type</a></li>
<li><a href="#attribute-type-options">Options Attribute Type</a></li>
</ol>
</div>
<hr class="spacer-large" />
<h2 id="essential-parameters-explained">@AttributeDefinition Essential Parameters Explained</h2>
<p>As we know, the most basic way to define a configuration will be to utilise the annotation @AttributeDefinition. Let&#8217;s explore the essential configurations.</p>
<p>The @AttributeDefinition annotation accepts parameters as such:</p>
<ul>
<li>line 2: <strong>name</strong>: defines the human read-able label</li>
<li>line 3: <strong>description</strong>: description for the attribute configuration.</li>
<li>line 4: <strong>type</strong>: definition of the attribute&#8217;s data type.</li>
<li>          line 6: <strong>&lt;T&gt;</strong>: definition of the attribute&#8217;s data type</li>
<li>          line 6: <strong>name_of_conf_reference</strong>: configuration&#8217;s reference id : name.of.conf.reference</li>
<li>          line 7: <strong>&lt;T&gt;[]</strong>: multifield (multi data set) is supported.
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><br />
description<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><br />
type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span><br />
<span style="color: #009900;">&#125;</span><br />
name_of_conf_reference<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #666666; font-style: italic;">// [] name_of_conf_reference_list() default &quot;&quot;;</span></div></td></tr></tbody></table></div>
<p><strong>Explained:</strong><br />
Illustrating how the label, description, and the configuration reference shows up on the OSGI Apache Felix console.<br />
<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-attribute-definition-legend-explained.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-attribute-definition-legend-explained.png" alt="OSGI Apache Felix Console - visual description of whats being reflected by the code." width="300" /></a></p>
<hr class="spacer-extra-large" />
<h2 id="attribute-types">Attribute Types</h2>
<p>With the understanding of how the <a href="#essential-parameters-explained">@AttributeDefinition Essential Parameters are used</a>, we can go ahead to utilise and to familiarize ourselves with the supported essential data attribute types; most of the basic attributes are covered below:</p>
<ol>
<li><a href="#attribute-type-string">String Attribute Type</a></li>
<li><a href="#attribute-type-string-array">String[] Attribute Type</a></li>
<li><a href="#attribute-type-long">Long Attribute Type</a></li>
<li><a href="#attribute-type-int">int Attribute Type</a></li>
<li><a href="#attribute-type-short">Short Attribute Type</a></li>
<li><a href="#attribute-type-char">Char Attribute Type</a></li>
<li><a href="#attribute-type-byte">byte Attribute Type</a></li>
<li><a href="#attribute-type-float">Float Attribute Type</a></li>
<li><a href="#attribute-type-double">Double Attribute Type</a></li>
<li><a href="#attribute-type-boolean">Boolean Attribute Type</a></li>
<li><a href="#attribute-type-password">Password Attribute Type</a></li>
<li><a href="#attribute-type-options">Options Attribute Type</a></li>
</ol>
<p>&nbsp;</p>
<h4 id="attribute-type-string">1. String Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">STRING</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #003399;">String</span> config_string_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #0000ff;">&quot;Default String&quot;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-string-array">2. String[] Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String[] Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;String[] Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">STRING</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> config_string_array_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;item1&quot;</span>, <span style="color: #0000ff;">&quot;item2&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<div align="center"><strong>Explained:</strong><br />
Illustrating how the multi-fields shows up on the OSGI Felix console.<br />
<a class="foobox" href="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-attribute-definition-multi-field-example.png" target="_blank" rel="noopener noreferrer"><img loading="lazy" decoding="async" src="https://sourcedcode.com/wp-content/uploads/2020/06/blog-post-attribute-definition-multi-field-example-150x150.png" alt="OSGI Apache Felix Console - Multi-Field Highlight Example" width="150" height="75" /></a></div>
<div class="mention-block"><strong>Note:</strong><br />
Configuration can be set as multifield can be enabled without much effort, simply change the attribute type to an list type, shown in the <a href="#attribute-type-string-array">#2. String[] Attribute Type example</a>.</div>
<hr class="spacer-large" />
<h4 id="attribute-type-long">3. Long Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Long Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Long Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">LONG</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">long</span> config_long_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> 0L<span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-int">4. int Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;int Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;innt Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">INTEGER</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">int</span> config_number_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-short">5. Short Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Short Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Short Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">SHORT</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">short</span> config_short_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-char">6. Char Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Char Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Char Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">CHARACTER</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">char</span> config_char_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-byte">7. Byte Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Byte Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Byte Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">BYTE</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">byte</span> config_byte_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<div class="mention-block"><strong>See Code Examples!</strong><br />
Click here to view <a href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-code-examples">OSGI R6 Configuration Code Examples</a>.</div>
<h4 id="attribute-type-double">8. Double Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Double Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Double Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">DOUBLE</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">double</span> config_double_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-float">9. Float Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Float Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Float Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">FLOAT</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">float</span> config_float_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-boolean">10. Boolean Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Boolean Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Boolean Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">BOOLEAN</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000066; font-weight: bold;">boolean</span> config_boolean_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-password">11. Password Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Password Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Password Config Example Description&quot;</span>,<br />
type <span style="color: #339933;">=</span> AttributeType.<span style="color: #006633;">PASSWORD</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #003399;">String</span> config_password_config_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h4 id="attribute-type-options">12. Options Attribute Type</h4>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@AttributeDefinition<span style="color: #009900;">&#40;</span><br />
name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Dropdown Label&quot;</span>,<br />
description <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Dropdown Config Example Description&quot;</span>,<br />
options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
@<span style="color: #003399;">Option</span><span style="color: #009900;">&#40;</span>label <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PRODUCTION&quot;</span>, value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PRODUCTION&quot;</span><span style="color: #009900;">&#41;</span>,<br />
@<span style="color: #003399;">Option</span><span style="color: #009900;">&#40;</span>label <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;STAGING&quot;</span>, value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;STAGING&quot;</span><span style="color: #009900;">&#41;</span>,<br />
@<span style="color: #003399;">Option</span><span style="color: #009900;">&#40;</span>label <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UAT&quot;</span>, value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UAT&quot;</span><span style="color: #009900;">&#41;</span>,<br />
@<span style="color: #003399;">Option</span><span style="color: #009900;">&#40;</span>label <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;QA&quot;</span>, value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;QA&quot;</span><span style="color: #009900;">&#41;</span>,<br />
@<span style="color: #003399;">Option</span><span style="color: #009900;">&#40;</span>label <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DEVELOP&quot;</span>, value <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;DEVELOP&quot;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#41;</span><br />
<span style="color: #003399;">String</span> config_dropdown_example<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">default</span> <span style="color: #0000ff;">&quot;DEVELOP&quot;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<hr class="spacer-large" />
<div class="mention-block"><strong>See Code Examples!</strong><br />
Click here to view <a href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-code-examples">OSGI R6 Configuration Code Examples</a>.</div>
</li>
</ul>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide">OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Articles List View</title>
		<link>https://sourcedcode.com/blog/aem/articles-list-view</link>
					<comments>https://sourcedcode.com/blog/aem/articles-list-view#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 31 May 2020 20:33:37 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1609</guid>

					<description><![CDATA[<p>Articles List View This is a list view of all the popular articles on sourcedcode.com to help you navigate to your needs quicker. I hope this will page will help you find what you need, faster and more efficient! OSGI OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide How to Enable Configuration for OSGI Components with [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/articles-list-view">Articles List View</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[		<div data-elementor-type="wp-post" data-elementor-id="1609" class="elementor elementor-1609" data-elementor-settings="[]">
						<div class="elementor-inner">
							<div class="elementor-section-wrap">
							<section class="elementor-section elementor-top-section elementor-element elementor-element-2570c31 elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="2570c31" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
							<div class="elementor-row">
					<div class="elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c264bb8" data-id="c264bb8" data-element_type="column">
			<div class="elementor-column-wrap elementor-element-populated">
							<div class="elementor-widget-wrap">
						<div class="elementor-element elementor-element-2f939e0 elementor-widget elementor-widget-heading" data-id="2f939e0" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h1 class="elementor-heading-title elementor-size-default">Articles List View</h1>		</div>
				</div>
				<div class="elementor-element elementor-element-2d70656 elementor-widget elementor-widget-text-editor" data-id="2d70656" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><p>This is a list view of all the popular articles on sourcedcode.com to help you navigate to your needs quicker. I hope this will page will help you find what you need, faster and more efficient!</p></div>
				</div>
				</div>
						</div>
					</div>
		</div>
								</div>
					</div>
		</section>
				<section class="elementor-section elementor-top-section elementor-element elementor-element-ba0bd2b elementor-section-boxed elementor-section-height-default elementor-section-height-default" data-id="ba0bd2b" data-element_type="section">
						<div class="elementor-container elementor-column-gap-default">
							<div class="elementor-row">
					<div class="elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-edee652" data-id="edee652" data-element_type="column">
			<div class="elementor-column-wrap elementor-element-populated">
							<div class="elementor-widget-wrap">
						<div class="elementor-element elementor-element-118d967 elementor-widget elementor-widget-heading" data-id="118d967" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">OSGI</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-49aa932 elementor-widget elementor-widget-text-editor" data-id="49aa932" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/osgi-r6-configuration-attributedefinition-essentials-reference-guide" rel="bookmark">OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide</a></li><li><a class="_self" href="https://sourcedcode.com/blog/aem/how-to-enable-configuration-for-osgi-components-with-r6" target="_self">How to Enable Configuration for OSGI Components with R6</a></li><li><a class="_self" href="https://sourcedcode.com/blog/aem/registering-slingservletpaths-component-property-type" target="_self">Registering @SlingServletPaths Component Property Type</a></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-b275438 elementor-widget elementor-widget-heading" data-id="b275438" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">Sling Models</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-8fa1521 elementor-widget elementor-widget-text-editor" data-id="8fa1521" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-reference-guide">AEM Sling Model Injectors Annotations Reference Guide</a></li><li><a href="https://sourcedcode.com/blog/aem/aem-sling-model-constructor-injection" rel="bookmark">AEM Sling Model Constructor Injection</a></li><li><a href="https://sourcedcode.com/blog/aem/aem-sling-model-field-injection-vs-constructor-injection-memory-consumption" rel="bookmark">AEM Sling Model Field Injection vs Constructor Injection Memory Consumption</a></li><li><a href="https://sourcedcode.com/blog/aem/aem-sling-models-injectors-service-ranking" rel="bookmark">AEM Sling Models Injectors Service Ranking</a></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-4bc738b elementor-widget elementor-widget-heading" data-id="4bc738b" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">JUNIT 4</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-c87179f elementor-widget elementor-widget-text-editor" data-id="c87179f" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul>
 	<li><a href="https://sourcedcode.com/blog/aem/aem-sling-models-unit-test-junit-4-with-examples" rel="bookmark">JUnit 4: AEM Sling Models Unit Test Example Using wcm.io AEM Mocks</a></li>
 	<li><a href="https://sourcedcode.com/blog/aem/junit-4-aem-wcmusepojo-unit-test-example-passing-paramaters" rel="bookmark">JUnit 4: AEM WCMUsePojo Unit Test Example (Passing Paramaters)</a></li>
 	<li><a href="https://sourcedcode.com/blog/aem/aem-sling-servlet-osgi-r7-by-resource-type-unit-test-junit-4-with-examples" rel="bookmark">JUnit 4: AEM Sling Servlet Unit Test Example Using wcm.io AEM Mocks, Servlet by Resource Type</a></li>
 	<li style="font-size: 14px;"><a style="font-size: 14px;" href="https://sourcedcode.com/blog/aem/junit-4-aem-sling-models-unit-test-constructor-injection-example" rel="bookmark">JUnit 4: AEM Sling Models Unit Test Constructor Injection Example</a></li>
</ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-efaf538 elementor-widget elementor-widget-heading" data-id="efaf538" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">Client Libraries, CSS, JavaScript</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-d3cbdef elementor-widget elementor-widget-text-editor" data-id="d3cbdef" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><span style="color: #ffb300;"><a href="/blog/aem/structural-static-assets-in-aem-as-client-library-resources">Structural Static Assets in AEM as Client Library Resources</a></span></li><li><a href="/blog/aem/how-to-serve-static-assets-in-aem-as-client-library-resources"><span style="color: #ffb300;">How to Serve Static Assets in AEM as Client Library Resources</span><br /></a></li><li><span style="color: #ffb300;"><a href="/blog/aem/how-to-include-javascript-for-an-aem-website">How to include JavaScript for an AEM Website</a></span></li><li style="font-size: 14px;"><span style="font-size: 14px; color: #ffb300;"><a href="https://sourcedcode.com/blog/aem/touch-ui/aem-richtext-max-characters-length-validation">AEM RichText Max Characters Length Validation</a></span></li><li><span style="color: #ffb300;"><a href="/blog/aem/3-different-ways-to-embed-custom-fonts-in-aem-sites">3 Different Ways to Embed Custom Fonts in AEM Sites</a></span></li><li><span style="color: #ffb300;"><a href="/blog/aem/with-htl-pass-data-from-aem-backend-to-javascript">With HTL, Pass Data from AEM Backend to Javascript</a></span></li></ul></div>
				</div>
				</div>
						</div>
					</div>
		</div>
				<div class="elementor-column elementor-col-50 elementor-top-column elementor-element elementor-element-16c8fd1" data-id="16c8fd1" data-element_type="column">
			<div class="elementor-column-wrap elementor-element-populated">
							<div class="elementor-widget-wrap">
						<div class="elementor-element elementor-element-a4dfa59 elementor-widget elementor-widget-heading" data-id="a4dfa59" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">JCR SQL-2</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-c3a038e elementor-widget elementor-widget-text-editor" data-id="c3a038e" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet">JCR SQL2 query strings to query for nodes in Java Content Repository</a></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-2ed9a40 elementor-widget elementor-widget-heading" data-id="2ed9a40" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">Granite UI 1.0</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-ec663e8 elementor-widget elementor-widget-text-editor" data-id="ec663e8" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-reference-guide">AEM Granite UI 1.0 Form Component’s XML Reference Guide</a></li><li><a href="https://sourcedcode.com/blog/aem/creating-a-basic-aem-touch-ui-dialogue" rel="bookmark">Creating a Basic AEM Touch UI Dialogue</a></li><li><a href="https://sourcedcode.com/blog/aem/how-to-convert-adobes-granite-ui-1-0-documentation-to-xml" rel="bookmark">How to Convert Adobe’s Granite UI 1.0 Documentation to XML</a></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-c8ea71e elementor-widget elementor-widget-heading" data-id="c8ea71e" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">Sightly</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-ae00bf7 elementor-widget elementor-widget-text-editor" data-id="ae00bf7" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl" rel="bookmark">AEM Global Objects for Backend and Front-end Sightly (HTL) Development</a></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-e99a61f elementor-widget elementor-widget-heading" data-id="e99a61f" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">AEM Web Server &amp; Dispatcher</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-578e79e elementor-widget elementor-widget-text-editor" data-id="578e79e" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><span style="color: #ffb300;"><a href="/blog/aem/how-to-setup-the-aem-dispatcher-flush-agent">How to Setup the AEM Dispatcher Flush Agent?</a></span></li></ul></div>
				</div>
				</div>
				<div class="elementor-element elementor-element-88bfbad elementor-widget elementor-widget-heading" data-id="88bfbad" data-element_type="widget" data-widget_type="heading.default">
				<div class="elementor-widget-container">
			<h3 class="elementor-heading-title elementor-size-medium">Misc How To's</h3>		</div>
				</div>
				<div class="elementor-element elementor-element-ebcc7d7 elementor-widget elementor-widget-text-editor" data-id="ebcc7d7" data-element_type="widget" data-widget_type="text-editor.default">
				<div class="elementor-widget-container">
					<div class="elementor-text-editor elementor-clearfix"><ul><li><a href="https://sourcedcode.com/blog/aem/how-many-times-is-an-aem-component-used-in-the-jcr">How many times is an AEM Component used in the JCR?</a></li><li><a href="https://sourcedcode.com/blog/aem/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client" aria-label="“How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman” (Edit)">How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman</a></li><li><a href="https://sourcedcode.com/blog/aem/how-to-write-javascript-unit-tests-for-aem-client-libraries-with-jest" aria-label="“How to write Javascript Unit Tests for AEM Client Libraries with Jest” (Edit)">How to write Javascript Unit Tests for AEM Client Libraries with Jest</a></li><li><a href="https://sourcedcode.com/blog/aem/how-to-enable-or-disable-aem-workflow-launchers" target="_self">How to enable/disable AEM Workflow Launchers</a></li><li><a href="https://sourcedcode.com/blog/aem/caching-experience-fragments-with-aem-sites-6-5" target="_self">Caching Experience Fragment Techniques in AEM Sites 6.5</a></li><li><a href="https://sourcedcode.com/blog/aem/scenario-building-aem-components-with-3rd-party-integrations-the-right-way" target="_self">Scenario: Building AEM Components with 3rd Party Integrations in a High Performance and Scalable Way</a></li><li><a href="https://sourcedcode.com/blog/aem/improve-performance-of-aem-components-during-development-phase" target="_self">Improve Performance of AEM Components During Development Phase</a></li><li><a href="https://sourcedcode.com/blog/aem/sugar-coating-servlet-scripts-and-paths" target="_self">Sugar Coat Registered AEM Servlet Scripts and Paths Endpoint</a></li><li style="font-size: 14px;"><a style="font-style: normal; background-color: transparent; pointer-events: auto; display: inline !important;" href="https://sourcedcode.com/blog/aem/5-popular-ways-to-replicate-a-page-in-aem" target="_self">5 Popular Ways to Replicate a Page in AEM</a></li><li><span style="color: #ffb300;"><a href="/blog/aem/development/basic-steps-to-debug-an-error-in-aem">Basic Steps to Debug an Error in AEM</a></span></li><li><span style="color: #ffb300;"><a href="/blog/aem/aem-quick-reference/aem-inheritedpageproperties-with-sightly-jsp-osgi-bundle">AEM inheritedpageproperties with Sightly, JSP, OSGI Bundle</a></span></li><li><span style="color: #ffb300;">How to Get AEM i18n Dictionary in JSON Format</span></li><li><span style="color: #ffb300;"><a href="/blog/aem/tool-generate-curl-command-to-update-osgi-configurations">Tool: Generate Curl Command to Update OSGI Configurations</a></span></li><li><span style="color: #ffb300;"><a href="/blog/aem/errors-while-building-the-latest-aem-project-archetype-24-on-macos">Errors while building the latest AEM Project Archetype 24 on MacOS</a></span></li></ul></div>
				</div>
				</div>
						</div>
					</div>
		</div>
								</div>
					</div>
		</section>
						</div>
						</div>
					</div>
		<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/articles-list-view">Articles List View</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/articles-list-view/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Granite UI 1.0 Form Component&#8217;s XML Cheat Sheet Reference Guide</title>
		<link>https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-cheat-sheet-reference-guide</link>
					<comments>https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-cheat-sheet-reference-guide#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 24 May 2020 12:57:12 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Touch UI]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1418</guid>

					<description><![CDATA[<p>This AEM Granite UI 1.0 Form Component&#8217;s XML Reference Guide provides code snippets to help developers speed up their AEM Touch UI development. This quick reference includes the most used Granite UI form components with plug and plays XML examples. Note: If you want to understand how to convert Granite UI 1.0 Form Components from [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-cheat-sheet-reference-guide">AEM Granite UI 1.0 Form Component&#8217;s XML Cheat Sheet Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This AEM Granite UI 1.0 Form Component&#8217;s XML Reference Guide provides code snippets to help developers speed up their AEM Touch UI development. This quick reference includes the most used Granite UI form components with plug and plays XML examples.</p>
<div class="mention-block">
<strong>Note:</strong><br />
If you want to understand how to convert Granite UI 1.0 Form Components from Adobe&#8217;s documentation to XML format, have a look at <a href="https://sourcedcode.com/blog/aem/how-to-convert-adobes-granite-ui-1-0-documentation-to-xml" title="How to convert Adobe’s Granite UI 1.0 Documentation to XML" rel="noopener noreferrer" target="_blank">article</a>. The article provides a step by step and easy to understand guide.
</div>
<style type="text/css">
.subtitle {
    display: block;
    font-size: 15px;
}
</style>
<p><strong>References:</strong></p>
<ol>
<li><a href="#granite-ui-checkbox">Checkbox</a></li>
<li><a href="#granite-ui-textfield">Text Field</a></li>
<li><a href="#granite-ui-textarea">Text Area</a></li>
<li><a href="#granite-ui-pathfield">Path Field</a></li>
<li><a href="#granite-ui-multifield">Multifield</a></li>
<li><a href="#granite-ui-select">Select</a></li>
<li><a href="#granite-ui-radiogroup">Radio Group</a></li>
<li><a href="#granite-ui-numberfield">Number Field</a></li>
<li><a href="#granite-ui-fileupload">File Upload</a></li>
<li><a href="#granite-ui-colorpicker">Color Picker</a></li>
<li><a href="https://sourcedcode.com/blog/aem/creating-a-basic-aem-touch-ui-dialogue" target="_blank" rel="noopener noreferrer">Creating a Basic AEM Touch UI Dialogue</a></li>
</ol>
<hr class="spacer-large"/>
<h3 id="granite-ui-checkbox">1. Checkbox <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;isChecked</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/checkbox&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;isChecked?&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./isChecked&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;isChecked flag&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">uncheckedValue</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/checkbox<br />
Documetation: <a href="https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/checkbox/index.html" rel="noopener nofollow noreferrer" target="_blank">https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/reference-materials/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/checkbox/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-textfield">2. Text Field <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;textfield-example</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;textfield-example&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./example&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;{String}Default Text&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;Show placeholder text when input field is empty.&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">disabled</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autocomplete</span>=<span style="color: #ff0000;">&quot;off&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autofocus</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">validation</span>=<span style="color: #ff0000;">&quot;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">maxlength</span>=<span style="color: #ff0000;">&quot;{Long}100&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;textfield-example-brandSlogan</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Brand Slogan&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./brandSlogan&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/textfield<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/textfield/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/textfield/index.html</a></p>
<h3 id="granite-ui-textarea">3. Text Area <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;textarea-example-description</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textarea&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Description&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./description&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;A hint to the user of what can be entered in the field.&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">disabled</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autocomplete</span>=<span style="color: #ff0000;">&quot;off&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autofocus</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">maxlength</span>=<span style="color: #ff0000;">&quot;{Long}160&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">rows</span>=<span style="color: #ff0000;">&quot;100&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">resize</span>=<span style="color: #ff0000;">&quot;both&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/textarea<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/textarea/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/textarea/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-pathfield">4. Path Field <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;pathfield-example-logoPath</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/pathfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Logo Path&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./logoPath&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">rootPath</span>=<span style="color: #ff0000;">&quot;/content/dam&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/pathfield<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/pathfield/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/pathfield/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-multifield">5. Multifield <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">// Multifield Country Eexample<br />
<span style="color: #000000; font-weight: bold;">&lt;countries</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/multifield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">composite</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Countries&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;field</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/container&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./countries&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;name</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;Name&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./name&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;code</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;Code&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./code&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/field<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/countries<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
// Navigation Links Example<br />
<span style="color: #000000; font-weight: bold;">&lt;navigationLinksMultifield</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/multifield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">composite</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Navigation Links&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;field</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/container&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./navLinks&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;linkLabel</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/textfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Link Label&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./linkLabel&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;linkPath</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/pathfield&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Link Path&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./linkPath&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">rootPath</span>=<span style="color: #ff0000;">&quot;/content&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;linkTarget</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/select&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;CTA Link Target&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./linkTarget&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;self</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">selected</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Same Page&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;_self&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;blank</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;New Tab&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;_blank&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/linkTarget<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/field<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/navigationLinksMultifield<span style="color: #000000; font-weight: bold;">&gt;</span></span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/multifield<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/multifield/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/multifield/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-select">6. Select <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;linkTarget</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/select&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;CTA Link Target&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./linkTarget&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;self</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">selected</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;Same Page&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;_self&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;blank</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;New Tab&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;_blank&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/linkTarget<span style="color: #000000; font-weight: bold;">&gt;</span></span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/select<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/select/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/select/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-radiogroup">7. Radio Group <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;radiogroup-example-columns</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/radiogroup&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">deleteHint</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Type&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./columns&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">vertical</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;columns1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">checked</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;1 Column&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;columns2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;2 Columns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;2&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;columns3</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">text</span>=<span style="color: #ff0000;">&quot;3 Columns&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;3&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/radiogroup-example-columns<span style="color: #000000; font-weight: bold;">&gt;</span></span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/radiogroup<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/radiogroup/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/radiogroup/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-numberfield">8. Number Field <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;numberfield-example-ageRestriction</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/numberfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Age Restriction&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">min</span>=<span style="color: #ff0000;">&quot;{Long}1&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">max</span>=<span style="color: #ff0000;">&quot;{Double}200&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./ageRestriction&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">disabled</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">step</span>=<span style="color: #ff0000;">&quot;1&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/numberfield<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/numberfield/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/numberfield/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-fileupload">9. File Upload <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<p>Note: How to disable the file upload, browser button, granite UI component&#8217;s upload feature will be to set the allowUpload property to false, indicated in the examples below.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">&lt;file</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;cq/gui/components/authoring/dialog/fileupload&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;cq-droptarget&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileNameParameter</span>=<span style="color: #ff0000;">&quot;./fileName&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileReferenceParameter</span>=<span style="color: #ff0000;">&quot;./fileReference&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">mimeTypes</span>=<span style="color: #ff0000;">&quot;[image/gif,image/jpeg,image/png,image/tiff,image/svg+xml]&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./file&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
// in sightly <span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${properties.fileReference}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">&lt;fileupload-example-file</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;cq/gui/components/authoring/dialog/fileupload&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autoStart</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;cq-droptarget&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Image asset&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileNameParameter</span>=<span style="color: #ff0000;">&quot;./fileName&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileReferenceParameter</span>=<span style="color: #ff0000;">&quot;./fileReference&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">mimeTypes</span>=<span style="color: #ff0000;">&quot;[image/gif,image/jpeg,image/png,image/tiff,image/svg+xml]&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">multiple</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./file&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Upload Image Asset&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">uploadUrl</span>=<span style="color: #ff0000;">&quot;${suffix.path}&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">useHTML5</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
// in sightly <span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${properties.fileReference}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
<br />
// disable allow upload<br />
<span style="color: #000000; font-weight: bold;">&lt;fileupload-example-downloadAsset</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;cq/gui/components/authoring/dialog/fileupload&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">allowUpload</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autoStart</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;cq-droptarget&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Download Asset&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileNameParameter</span>=<span style="color: #ff0000;">&quot;./fileName&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fileReferenceParameter</span>=<span style="color: #ff0000;">&quot;./fileReference&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">mimeTypes</span>=<span style="color: #ff0000;">&quot;[image/*,video/*,audio/*,.pdf,.doc,.zip,.txt]&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">multiple</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./downloadAsset&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Upload Asset&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">uploadUrl</span>=<span style="color: #ff0000;">&quot;${suffix.path}&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">useHTML5</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
// in sightly <span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;${properties.fileReference}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: cq/gui/components/authoring/dialog/fileupload<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/fileupload/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/fileupload/index.html</a></p>
<hr class="spacer-large"/>
<h3 id="granite-ui-colorpicker">10. Color Picker <span class="subtitle">Granite UI 1.0, Touch UI XML Example:</span></h3>
<p>Note: the variant properties can be set for two different outcomes; &#8220;default&#8221; allows the authors to insert custom hex values, while the set value of &#8220;swatch&#8221; does not allow custom hex selection.</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br /></div></td><td><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">//swatch example<br />
<span style="color: #000000; font-weight: bold;">&lt;colorfield-swatch-example-brandColor</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/colorfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Brand Color&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./brandColor&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;Please choose a color&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">disabled</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">variant</span>=<span style="color: #ff0000;">&quot;swatch&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autogenerateColors</span>=<span style="color: #ff0000;">&quot;off&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showDefaultColors</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showProperties</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showSwatches</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;items</span> <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;color1</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#FF4136&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;color2</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;#0077D9&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;/items<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<span style="color: #000000; font-weight: bold;">&lt;/colorfield-swatch-example-brandColor<span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
//properties example <span style="color: #66cc66;">&#40;</span>choosing colors from a color wheel<br />
<span style="color: #000000; font-weight: bold;">&lt;colorfield-properties-example-brandColor</span><br />
&nbsp; &nbsp; <span style="color: #000066;">jcr:primaryType</span>=<span style="color: #ff0000;">&quot;nt:unstructured&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">sling:resourceType</span>=<span style="color: #ff0000;">&quot;granite/ui/components/coral/foundation/form/colorfield&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">fieldLabel</span>=<span style="color: #ff0000;">&quot;Brand Color&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;./brandColor&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">emptyText</span>=<span style="color: #ff0000;">&quot;Please choose a color&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">disabled</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">required</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">variant</span>=<span style="color: #ff0000;">&quot;default&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">autogenerateColors</span>=<span style="color: #ff0000;">&quot;off&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showDefaultColors</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showProperties</span>=<span style="color: #ff0000;">&quot;{Boolean}true&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">showSwatches</span>=<span style="color: #ff0000;">&quot;{Boolean}false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></div></td></tr></tbody></table></div>
<p>sling:resourceType: granite/ui/components/coral/foundation/form/colorfield<br />
Documentation: <a href="https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/colorfield/index.html" rel="noopener nofollow noreferrer" target="_blank">https://developer.adobe.com/experience-manager/reference-materials/6-5/granite-ui/api/jcr_root/libs/granite/ui/components/coral/foundation/form/colorfield/index.html</a></p>
<div class="mention-block">
<strong>Recommended Note:</strong><br />
If you want to understand how to convert Granite UI 1.0 Form Components from Adobe&#8217;s documentation to XML format, have a look at <a href="https://sourcedcode.com/blog/aem/how-to-convert-adobes-granite-ui-1-0-documentation-to-xml" title="How to convert Adobe’s Granite UI 1.0 Documentation to XML" rel="noopener noreferrer" target="_blank">article</a>. The article provides a step by step and easy to understand guide.
</div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-cheat-sheet-reference-guide">AEM Granite UI 1.0 Form Component&#8217;s XML Cheat Sheet Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-granite-ui-1-0-form-components-xml-cheat-sheet-reference-guide/feed</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Sling Model Injectors Annotations Cheat Sheet Reference Guide</title>
		<link>https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide</link>
					<comments>https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sat, 04 Jan 2020 15:20:37 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Sling Models]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=1180</guid>

					<description><![CDATA[<p>The Apache Sling Model enables injector specific annotations which aggregate the standard annotations for each of the available injector, which are: Script Bindings, Value Map, Resource Path, Child Resources, Request Attributes, OSGI Services, Self, and the Sling Object. Sure we can invoke injectors by the @inject, followed by the @source annotation (with an injector name) [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide">AEM Sling Model Injectors Annotations Cheat Sheet Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The Apache Sling Model enables injector specific annotations which aggregate the standard annotations for each of the available injector, which are: <a href="#ScriptVariable">Script Bindings</a>, <a href="#ValueMapValue">Value Map</a>, <a href="#ResourcePath">Resource Path</a>, <a href="#ChildResource">Child Resources</a>, <a href="#RequestAttribute">Request Attributes</a>, <a href="#OSGiService">OSGI Services</a>, <a href="#Self">Self</a>, and the <a href="#SlingObject">Sling Object</a>. </p>
<p>Sure we can invoke injectors by the @inject, followed by the @source annotation (with an injector name) as so, @Inject @Source(“script-bindings”), but invoking such injectors introduces many more lines of code which is tedious and repetitive. Using the @inject annotation freely may cause injector collisions.</p>
<div class="mention-block">
<strong> Thankfully Apache&#8217;s Sling Model library delivered the injector specific annotations!</strong><br />
The injector specific annotations enable us, developers, to write less code, enables stability with injectors to demise injector collisions, and enables better IDE support.
</div>
<p>This article will provide examples (used in practice) which will include both ways to invoke injectors in Sling Models, using the @Inject &#038; @Source annotations, and also the Apache Sling Model injector specific annotations approach.</p>
<hr/>
<h2>Available Injectors</h2>
<ol>
<li><a href="#ScriptVariable">@ScriptVariable</a></li>
<li><a href="#ValueMapValue">@ValueMapValue</a></li>
<li><a href="#ResourcePath">@ResourcePath</a></li>
<li><a href="#ChildResource">@ChildResource</a></li>
<li><a href="#RequestAttribute">@RequestAttribute</a></li>
<li><a href="#OSGiService">@OSGiService</a></li>
<li><a href="#Self">@Self</a></li>
<li><a href="#SlingObject">@SlingObject</a></li>
</ol>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h4 id="ScriptVariable">1. Script Bindings (name=&#8221;script-bindings&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 1000<br />
<b>Annotation:</b> @ScriptVariable<br />
<b>Description:</b> Injects objects via script variable defined from <a href="https://cwiki.apache.org/confluence/display/SLING/Scripting+variables#Scriptingvariables-Sling'sscriptingvariablesandscriptlanguages" rel="noopener noreferrer" target="_blank">Sling Bindings</a>; Lookup objects in the script bindings object by name.</p>
<div class="mention-block">
As you can see, the example below indicated that there are many ways to inject within the POJO:</p>
<p><strong>Without the injector specific annotations:</strong></p>
<ul>
<li>1. @Inject @Source(&#8220;script-bindings&#8221;) @Named(&#8220;component&#8221;)</li>
<li>2. @Inject @Source(&#8220;script-bindings&#8221;)</li>
</ul>
<p><strong>With the injector specific annotations:</strong></p>
<ul>
<li>3. @ScriptVariable(name = &#8220;component&#8221;)</li>
<li>4. @ScriptVariable</li>
</ul>
<p><strong>Note:</strong> If the name is not set (using the @Named annotation or name property), then the name is derived from the method/property/variable/field name. </p>
<p>A full list of the scripting variables can be found <a href="https://sourcedcode.com/aem-global-objects-for-backend-and-front-end-sightly-htl#mappings" rel="noopener noreferrer" target="_blank">here</a>.
</div>
<div class="code-large">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>Resource.<span style="color: #000000; font-weight: bold;">class</span>, SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span>,<br />
&nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;component&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @ScriptVariable(name = &quot;component&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Component</span> component<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;componentContext&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> ComponentContext componentContext<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;currentDesign&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Design currentDesign<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;currentNode&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Node currentNode<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;currentPage&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Page currentPage<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;currentSession&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> HttpSession currentSession<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;currentStyle&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Style</span> currentStyle<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;designer&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Designer designer<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;editContext&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> EditContext editContext<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;log&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Logger log<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;out&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">PrintWriter</span> out<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;pageManager&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> PageManager pageManager<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;pageProperties&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> ValueMap pageProperties<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;reader&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">BufferedReader</span> reader<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;request&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletRequest request<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;resolver&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> ResourceResolver resolver<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;resource&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource resource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;resourceDesign&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Design resourceDesign<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;resourcePage&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Page resourcePage<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;response&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletResponse response<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;sling&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingScriptHelper sling<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;slyWcmHelper&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> WCMScriptHelper slyWcmHelper<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;wcmmode&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SightlyWCMMode wcmmode<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;) @Named(&quot;xssAPI&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;script-bindings&quot;)</span><br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> XSSAPI xssAPI<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<hr class="spacer-large"/>
<h4 id="ValueMapValue">2. Value Map (name=&#8221;valuemap&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 2000<br />
<b>Annotation:</b> @ValueMapValue<br />
<b>Description:</b> Gets a property from a ValueMap by name; If @Via is not set, it will automatically take resource if the adaptable is the SlingHttpServletRequest. If name is not set the name is derived from the method/field name.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;valuemap&quot;) @Named(&quot;jcr:title&quot;)</span><br />
&nbsp; &nbsp; @ValueMapValue<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;jcr:title&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> titleText<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;valuemap&quot;)</span><br />
&nbsp; &nbsp; @ValueMapValue<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> titleDescription<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h4 id="ResourcePath">3. Resource Path (name=&#8221;resource-path&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 2500<br />
<b>Annotation:</b> @ResourcePath<br />
<b>Description:</b> Injects one or multiple resources. The resource paths are either given by @Path annotations, the element path or paths of the annotation @ResourcePath or by paths given through a resource property being referenced by either @Named or element name of the annotation @ResourcePath.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;resource-path&quot;) @Path(&quot;/content/sourcedcode/en/home&quot;)</span><br />
&nbsp; &nbsp; @ResourcePath<span style="color: #009900;">&#40;</span>path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/content/sourcedcode/en/home&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; Resource sourcedCodePageResource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;resource-path&quot;) @Path(&quot;/content/we-retail/language-masters/en&quot;)</span><br />
&nbsp; &nbsp; @ResourcePath<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/content/we-retail/language-masters/en&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; Resource weRetailPageResource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;resource-path&quot;) @Path(paths = {&quot;/content/sourcedcode/en/home&quot;,&quot;/content/we-retail/language-masters/en&quot;})</span><br />
&nbsp; &nbsp; @ResourcePath<span style="color: #009900;">&#40;</span>paths <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;/content/sourcedcode/en/home&quot;</span>,<span style="color: #0000ff;">&quot;/content/we-retail/language-masters/en&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; Resource<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> &nbsp;resources<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h4 id="ChildResource">4. Child Resources (name=&#8221;child-resources&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 3000<br />
<b>Annotation:</b> @ChildResource<br />
<b>Description:</b> Gets a child resource by name.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;child-resources&quot;) @Named(&quot;links&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @ChildResource(name=&quot;links&quot;)</span><br />
&nbsp; &nbsp; @ChildResource<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource links<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;child-resources&quot;) @Named(&quot;links&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @ChildResource(name=&quot;links&quot;)</span><br />
&nbsp; &nbsp; @ChildResource<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>Resource<span style="color: #339933;">&gt;</span> links<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;child-resources&quot;) @Named(&quot;social&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @ChildResource(name=&quot;social&quot;)</span><br />
&nbsp; &nbsp; @ChildResource<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource social<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<hr class="spacer-large"/>
<h4 id="RequestAttribute">5. Request Attributes (name=&#8221;request-attributes&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 4000<br />
<b>Annotation:</b> @RequestAttribute<br />
<b>Description:</b> Injects a request attribute by name. If name is not set the name is derived from the method/field name.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;request-attributes&quot;) @Named(&quot;social&quot;)</span><br />
&nbsp; &nbsp; @RequestAttribute<span style="color: #009900;">&#40;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;social&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> socialParam<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;request-attributes&quot;) @Named(&quot;link&quot;)</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @RequestAttribute(name = &quot;link&quot;)</span><br />
&nbsp; &nbsp; @RequestAttribute<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> link<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getSocialParam<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> socialParam<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getLink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> link<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The example below calls the Sling Model using input parameter:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">&nbsp;<span style="color: #009900;">&lt;sly data-sly-use.example<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;${'com.sourcedcode.core.models.ExampleComponent' @ social=currentPage.title,link=currentPage.path}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; ${example.socialParam}<br />
&nbsp; &nbsp; ${example.link}<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>sly&gt;</span></div></td></tr></tbody></table></div>
<div class="mention-block">
A really great example of the use of this annotation can be found in this <a href="/blog/aem/how-to-pass-parameters-to-sling-modal-from-sightly-htl-component" target="_blank" rel="noopener">article</a>.
</div>
</li>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #3 --><br />
<ins class="adsbygoogle"
     style="display: block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="3385248102"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h4 id="OSGiService">6. OSGi Services (name=&#8221;osgi-services&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> 5000<br />
<b>Annotation:</b> @OSGiService<br />
<b>Description:</b> Injects an OSGi service by type; Lookup services based on class name. Since Sling Models Impl 1.2.8 (SLING-5664) the service with the highest service ranking is returned. In case multiple services are returned, they are ordered descending by their service ranking (i.e. the one with the highest ranking first).</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;osgi-services&quot;)</span><br />
&nbsp; &nbsp; @OSGiService<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingSettingsService slingSettingsService<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;osgi-services&quot;)</span><br />
&nbsp; &nbsp; @OSGiService<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> MyCustomOSGIService myCustomOSGIService<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;osgi-services&quot;)</span><br />
&nbsp; &nbsp; @OSGiService<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> MyCustomOSGISConfigurationervice myCustomOSGISConfigurationervice<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<hr class="spacer-large"/>
<h4 id="Self">7. Self (name=&#8221;self&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> Integer.MAX_VALUE<br />
<b>Annotation:</b> @Self<br />
<b>Description:</b> Injects the adaptable object itself (if the class of the field matches or is a supertype). If the @Self annotation is present it is tried to adapt the adaptable to the field type.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;self&quot;)</span><br />
&nbsp; &nbsp; @Self<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Node node<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;self&quot;)</span><br />
&nbsp; &nbsp; @Self<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> MyCustomSlingModel myCustomSlingModel<span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">///////</span><br />
<span style="color: #666666; font-style: italic;">///////</span><br />
<span style="color: #666666; font-style: italic;">/////// Example below highlights that the @self annotation can minimize the lines of code that needs to be written.</span><br />
<span style="color: #666666; font-style: italic;">///////</span><br />
<span style="color: #666666; font-style: italic;">///////</span><br />
@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource currentResource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; Node node<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @PostConstruct<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// adapts the current resource to a node class</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; node <span style="color: #339933;">=</span> currentResource.<span style="color: #006633;">adaptTo</span><span style="color: #009900;">&#40;</span>Node.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #4 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2079905296"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h4 id="SlingObject">8. Sling Object (name=&#8221;sling-object&#8221;) Injector</h4>
<p><b><a href="/aem-sling-models-injectors-service-ranking" target="_blank" rel="noopener noreferrer">Service Ranking:</a></b> Integer.MAX_VALUE<br />
<b>Annotation:</b> @SlingObject<br />
<b>Description:</b> Injects commonly used sling objects if the field matches with the class: request, response, resource resolver, current resource, SlingScriptHelper. This works only if the adaptable can get the according information, i.e. all objects are available via SlingHttpServletRequest while ResourceResolver can only resolve the ResourceResolver object and nothing else. A discussion around this limitation can be found at SLING-4083. Also Resources can only be injected if the according injector specific annotation is used (@SlingObject).</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> Resource.<span style="color: #000000; font-weight: bold;">class</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; defaultInjectionStrategy <span style="color: #339933;">=</span> DefaultInjectionStrategy.<span style="color: #006633;">OPTIONAL</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;sling-object&quot;)</span><br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletRequest slingHttpServletRequest<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;sling-object&quot;)</span><br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletResponse slingHttpServletResponse<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;sling-object&quot;)</span><br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource currentResource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// @Inject @Source(&quot;sling-object&quot;)</span><br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> ResourceResolver resourceResolver<span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
</ul>
<div class="mention-block">
<strong>Note:</strong><br />
If the name is not set (using the @Named annotation or name property), then the name is derived from the method/property/variable/field name. An example for setting the @Named annotation would time you as a developer encounter a clash between the method/property/variable/field name or when developer not wanting to use the scripting variable names as the variables in the POJO.</p>
<p>As you can see, using the Apache Sling Model&#8217;s injector specific annotations during implementation will help you stay organised, write less code, and speed up the development process.
</p></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #5 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="5183553115"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide">AEM Sling Model Injectors Annotations Cheat Sheet Reference Guide</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-sling-model-injectors-annotations-cheat-sheet-reference-guide/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>AEM Global Objects for Backend and Front-end Sightly (HTL) Development</title>
		<link>https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl</link>
					<comments>https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sat, 25 May 2019 15:02:29 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<guid isPermaLink="false">https://sourcedcode.com/?p=320</guid>

					<description><![CDATA[<p>While working on an AEM project, we can speed up the process of development by utilizing the global objects offered by AEM Framework. Quick Links Backend Example Front-end Examples Sightly/HTL &#38; AEM Backend Objects Mapping 1. AEM Backend, an example of using global objects The global objects are accessible by OSGI&#8217;s dependency injection annotation; @inject. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl">AEM Global Objects for Backend and Front-end Sightly (HTL) Development</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>While working on an AEM project, we can speed up the process of development by utilizing the <a href="#docs">global objects</a> offered by AEM Framework.</p>
<div class="mention-block">Quick Links</p>
<ol>
<li><a href="#back">Backend Example</a></li>
<li><a href="#front">Front-end Examples</a></li>
<li><a href="#mappings">Sightly/HTL &amp; AEM Backend Objects Mapping</a></li>
</ol>
</div>
<hr class="spacer-large"/>
<h2 id="back">1. AEM Backend, an example of using <a href="#docs">global objects</a></h2>
<ul>
<li>The <a href="#docs">global objects</a> are accessible by OSGI&#8217;s dependency injection annotation; @inject.</li>
<li>GET, SET, and other methods can be invoked by the POJO class.</li>
</ul>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.day.cq.wcm.api.Page</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.resource.Resource</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.models.annotations.Model</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.annotation.PostConstruct</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.inject.Inject</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.logging.Logger</span><span style="color: #339933;">;</span><br />
<br />
@Model<span style="color: #009900;">&#40;</span>adaptables <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>SlingHttpServletRequest.<span style="color: #000000; font-weight: bold;">class</span>, Resource.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; resourceType <span style="color: #339933;">=</span> ExampleComponent.<span style="color: #006633;">RESOURCE_TYPE</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ExampleComponent <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> RESOURCE_TYPE <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;sourcedc/components/structure/examplecomponent&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Logger log<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletResponse response<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @SlingObject<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> SlingHttpServletRequest request<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Page currentPage<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @ScriptVariable<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> Resource resource<span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; @PostConstruct<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> componentsProp <span style="color: #339933;">=</span> resource.<span style="color: #006633;">getValueMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;subtitleText&quot;</span>, <span style="color: #003399;">String</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> currentPagePath <span style="color: #339933;">=</span> currentPage.<span style="color: #006633;">getPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> userID <span style="color: #339933;">=</span> request.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;userid&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> localeCountry <span style="color: #339933;">=</span> response.<span style="color: #006633;">getLocale</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getCountry</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// setting json response</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> contentType <span style="color: #339933;">=</span> response.<span style="color: #006633;">getContentType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; log.<span style="color: #006633;">info</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Example component initiated.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large"/>
<h2 id="front">2. AEM Front-End, example of using the <a href="#docs">global objects</a>, stored in reserved variables:</h2>
<ul>
<li>The <a href="#docs">global objects</a> are accessible by using unique variables (defined below).</li>
<li>Only GET methods can be invoked by Sightly/HTL.</li>
<li>While previewing the java documentation, only the get methods can be used. While using the global object, exclude the &#8220;get&#8221; prefix.</li>
</ul>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">Current Page Path : ${currentPage.path} <span style="color: #808080; font-style: italic;">&lt;!-- javadocs : getPath(); --&gt;</span><br />
<br />
Current Page Name : ${currentPage.name} <span style="color: #808080; font-style: italic;">&lt;!-- javadocs : getName(); --&gt;</span><br />
<br />
response country : ${response.locale.country} <span style="color: #808080; font-style: italic;">&lt;!-- javadocs : getLocale().getCountry(); --&gt;</span><br />
<br />
response type : ${response.contentType} <span style="color: #808080; font-style: italic;">&lt;!-- javadocs : geetContentType(); --&gt;</span><br />
<br />
component's property subTitleText : ${properties.subTitleText}<br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!-- loop through all children page's of current page --&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> data-sly-list<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>${child.name}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<br />
// this article does not cover the usage of the Sightly(HTL) syntax. For a quick reference, check out this document: <br />
https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md</div></td></tr></tbody></table></div>
<hr class="spacer-large"/>
<h2 id="mappings">3. Mapping of Sightly/HTL Variables and AEM Backend Objects:</h2>
<table class="table">
<thead class="thead">
<tr class="row">
<th class="entry">
<div>
<div class="p">
<div>Sightly/HTL Variables</div>
</div>
</div>
</th>
<th class="entry">
<div>
<div class="p">
<div>AEM Backend Objects</div>
</div>
</div>
</th>
<th class="entry">
<div>
<div class="p">
<div>Documentation</div>
</div>
</div>
</th>
</tr>
</thead>
<tbody class="tbody">
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>component</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.components.Component</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/wcm/api/components/Component.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>componentContext</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.components.ComponentContext</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/wcm/api/components/ComponentContext.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>currentDesign</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.designer.Design</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/designer/Design.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>currentNode</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>javax.jcr.Node</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/spec/jdiff-jcr1-jcr2/changes/javax.jcr.Node.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>currentPage</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.Page</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/Page.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>currentSession</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>javax.servlet.http.HttpSession</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/cloud-service/javadoc/javax/servlet/http/HttpSession.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>currentStyle</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.designer.Style</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/designer/Style.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>designer</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.designer.Designer</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/designer/Designer.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>editContext</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.components.EditContext</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/components/EditContext.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>log</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.slf4j.Logger</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/cloud-service/javadoc/org/slf4j/Logger.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>out</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>java.io.PrintWriter</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>pageManager</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.PageManager</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/PageManager.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>reader</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>java.io.BufferedReader</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://docs.oracle.com/javase/8/docs/api/java/io/BufferedReader.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>request</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.apache.sling.api.SlingHttpServletRequest</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://sling.apache.org/apidocs/sling11/org/apache/sling/api/SlingHttpServletRequest.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>resolver</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.apache.sling.api.resource.ResourceResolver</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>resource</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.apache.sling.api.resource.Resource</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/Resource.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>resourceDesign</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.designer.Design</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/designer/Design.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>resourcePage</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.day.cq.wcm.api.Page</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/day/cq/wcm/api/Page.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>response</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.apache.sling.api.SlingHttpServletResponse</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://sling.apache.org/apidocs/sling11/org/apache/sling/api/SlingHttpServletRequest.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>sling</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>org.apache.sling.api.scripting.SlingScriptHelper</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://sling.apache.org/apidocs/sling11/org/apache/sling/api/scripting/SlingScriptHelper.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>slyWcmHelper</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.adobe.cq.sightly.WCMScriptHelper</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/adobe/cq/sightly/WCMScriptHelper.html" target="_blank" rel="noopener noreferrer">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>wcmmode</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div>
<div>com.adobe.cq.sightly.SightlyWCMMode</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div class="p">
<div><a href="https://www.adobe.io/experience-manager/reference-materials/cloud-service/javadoc/com/adobe/cq/sightly/SightlyWCMMode.html" target="_blank" rel="noopener">documentation</a></div>
</div>
</div>
</td>
</tr>
<tr class="row">
<td class="entry">
<div>
<div class="p">
<div>
<div>xssAPI</div>
</div>
</div>
</div>
</td>
<td class="entry">
<div>
<div>
<div class="p">
<div>
<div>com.adobe.granite.xss.XSSAPI</div>
</div>
</div>
</div>
</div>
</td>
<td><a href="https://www.adobe.io/experience-manager/reference-materials/6-5/javadoc/com/adobe/granite/xss/XSSAPI.html" target="_blank" rel="noopener noreferrer">documentation</a></td>
</tr>
</tbody>
</table>
<div class="mention-block">
<strong>Got Questions?</strong></p>
<p>If you have any comments or topics that you would like me to cover, please leave a comment below.
</p>
</div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl">AEM Global Objects for Backend and Front-end Sightly (HTL) Development</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-global-objects-for-backend-and-front-end-sightly-htl/feed</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>How to use AEM JCR SQL2 query strings to query for nodes in Java Content Repository</title>
		<link>https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet</link>
					<comments>https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet#comments</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Mon, 02 Apr 2018 19:31:06 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Sling Servlet]]></category>
		<category><![CDATA[Video Tutorial]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=82</guid>

					<description><![CDATA[<p>JCR-SQL2 (Java Content Repository &#8211; Structured Query Language 2) is domain specific language used to query JCR nodes held in the JCR repository. The syntax for JCR-SQL2 is fairly similar to SQL, so if you have some experience with SQL, this tutorial will be a walk in the park for you. The best way to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet">How to use AEM JCR SQL2 query strings to query for nodes in Java Content Repository</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>JCR-SQL2 (Java Content Repository &#8211; Structured Query Language 2) is domain specific language used to query JCR nodes held in the JCR repository. The syntax for JCR-SQL2 is fairly similar to SQL, so if you have some experience with SQL, this tutorial will be a walk in the park for you.</p>
<p>The best way to learn the power of the JCR-SQL2 language is to try it out on CRX/DE Lite. Without future or do, below will be a lesson on JCR-SQL2. To locate CRX/DE Lite&#8217;s query tool, visit <a href="http://localhost:4502/crx/de/index.jsp" rel="noopener noreferrer" target="_blank">http://localhost:4502/crx/de/index.jsp</a>, then select on the tools drop down, and choose query.</p>
<div class="mention-block--gold">
<h3>2023 Added Section: SQL-JCR2 Snippets</h3>
<p>Examples can be found at the bottom of this tutorial, <a href="#jcr-sql2-code-snippets-cheat-sheet">JCR-SQL2 Code Snippets Cheat Sheet</a>, where you can find some examples for real life use cases. Head into your <a href="http://localhost:4502/crx/de/index.jsp" rel="noopener" target="_blank">crx-de > tools > query > type:JCR SQL2</a>, and try it our yourself.
</div>
<p><img loading="lazy" decoding="async" src="http://sourcedcode.com/wp-content/uploads/2018/04/tools-query-tool-1024x662.png" alt="" width="1024" height="662" class="alignnone size-large wp-image-167" srcset="https://sourcedcode.com/wp-content/uploads/2018/04/tools-query-tool-1024x662.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/04/tools-query-tool-300x194.png 300w, https://sourcedcode.com/wp-content/uploads/2018/04/tools-query-tool-768x496.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<hr />
<h2>JCR-SQL2 Syntax</h2>
<ol>
<li><a href="#select-statement">SELECT Statement</a></li>
<li><a href="#name-statement">NAME() Statement</a></li>
<li><a href="#isdescendantnode-statement">ISDESCENDANTNODE Statement</a></li>
<li><a href="#contains-operator">CONTAINS Statement</a></li>
<li><a href="#like-operator">LIKE Operator</a></li>
<li><a href="#is-not-null">IS NOT NULL Property</a></li>
<li><a href="#order-by-keyword">ORDER BY Keyword</a></li>
<li><a href="#cast-statement">CAST() Statement</a></li>
<li><a href="#jcr-sql2-code-snippets-cheat-sheet">JCR-SQL2 Code Snippets Cheat Sheet</a> (new 2023)</li>
<li><a href="#jcr-sql2-java-code-example-servlet">JCR SQL2 Java Code Example Servlet</a> (new 2023)</li>
</ol>
<p><iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/0sMMzJs1dpc" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe></p>
<hr class="spacer-large" />
<h4 id="select-statement">1. The JCR-SQL2 SELECT Statement</h4>
<ul>
<li>The SELECT statement is used to select all JCR nodes that matches the JCR node&#8217;s primary type.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- nt:base is a primary type that represents every single node in the JCR.</span><br />
<span style="color: #808080; font-style: italic;">-- returns all nodes in the JCR.</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:Page] nodes</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [dam:Asset] nodes</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>dam:Asset<span style="color: #FF00FF;">&#93;</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large" />
<h4 id="name-statement">2. The JCR-SQL2 NAME() Statement</h4>
<ul>
<li>Selecting nodes with a specific node name.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all [cq:Page] nodes WHERE the node's name is equal to &quot;we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> NAME<span style="color: #FF00FF;">&#40;</span>nodes<span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;we-retail&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [dam:Asset] nodes WHERE the node's name is equal to &quot;we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>dam:Asset<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> NAME<span style="color: #FF00FF;">&#40;</span>nodes<span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;we-retail&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-large" />
<h4 id="isdescendantnode-statement">3. The JCR-SQL2 ISDESCENDANTNODE Statement</h4>
<ul>
<li>Selecting nodes under a file path.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all nodes WHERE nodes exist under &quot;/content/we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:Page] nodes WHERE nodes exist under &quot;/content/we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [dam:Asset] nodes WHERE nodes exist under &quot;/content/dam/we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>dam:Asset<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>dam<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [nt:unstructured] nodes WHERE nodes exist under &quot;/content/we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:unstructured<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<hr class="spacer-large" />
<h4 id="contains-statement">4. The JCR-SQL2 CONTAINS Statement</h4>
<ul>
<li>Selecting nodes where the properties contain a value.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all nodes WHERE node's property jcr:title CONTAINS &quot;we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #00CC00;">CONTAINS</span><span style="color: #FF00FF;">&#40;</span>nodes.title<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:Page] nodes where node's property jcr:title CONTAINS &quot;we-retail&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> <span style="color: #00CC00;">CONTAINS</span><span style="color: #FF00FF;">&#40;</span>nodes.title<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large" />
<h4 id="like-operator">5. The JCR-SQL2 LIKE Operator</h4>
<ul>
<li>The LIKE operator is used to search for a specified pattern in node properties.</li>
<li>There are two wildcards used in conjunction with the LIKE operator: % and _</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under &quot;/content&quot; </span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title starts with any values and ends with &quot;w&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">LIKE</span> <span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">%</span>w&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under &quot;/content&quot; </span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title starts with &quot;w&quot; and ends with any values</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">LIKE</span> <span style="color: #008000;">&quot;w<span style="color: #008080; font-weight: bold;">%</span>&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under &quot;/contentl&quot; </span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title matching &quot;w&quot; in any position</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">LIKE</span> <span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">%</span>w<span style="color: #008080; font-weight: bold;">%</span>&quot;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under &quot;/content&quot; </span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title start with any values and have &quot;w&quot; in the second position and ends with any values</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">LIKE</span> <span style="color: #008000;">&quot;<span style="color: #008080; font-weight: bold;">_</span>w<span style="color: #008080; font-weight: bold;">%</span>&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-large" />
<h4 id="is-not-null">6. The JCR-SQL2 IS NOT NULL Property</h4>
<ul>
<li>Used for validation of property&#8217;s value is not null.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all nodes WHERE nodes exist under &quot;/content&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title IS NOT NULL</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">IS NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under &quot;/content&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- AND node's property jcr:title IS NOT NULL</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099; font-weight: bold;">IS NOT</span> <span style="color: #9900FF; font-weight: bold;">NULL</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #3 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="3385248102"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<hr class="spacer-large" />
<h4 id="order-by-keyword">7. The JCR-SQL2 ORDER BY Keyword</h4>
<ul>
<li>The ORDER BY keyword is used to sort the result-set in ascending or descending order.</li>
<li>Returned values are sorted by default in ascending order.</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all nodes WHERE nodes exist under the &quot;/content/we-retail&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- ORDER BY jcr:created ascending</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span> <br />
<span style="color: #990099; font-weight: bold;">ORDER BY</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:created<span style="color: #FF00FF;">&#93;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all nodes WHERE nodes exist under the &quot;/content/we-retail&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- ORDER BY node's property jcr:created descending</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:base<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">ORDER BY</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:created<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">DESC</span></div></td></tr></tbody></table></div>
<hr class="spacer-large" />
<h4 id="cast-statement">8. The JCR-SQL2 CAST() Statement</h4>
<ul>
<li>Convert an expression from one data type to another.</li>
<li>Cast Types:
<ul>
<li>STRING</li>
<li>BINARY</li>
<li>DATE</li>
<li>LONG</li>
<li>DOUBLE</li>
<li>DECIMAL</li>
<li>BOOLEAN</li>
<li>NAME</li>
<li>PATH</li>
<li>REFERENCE</li>
<li>WEAKREFERENCE</li>
<li>URI</li>
</ul>
</li>
<li><b>Returns in CRX/DE Lite</b>: A list of JCR nodes in the results table with their corresponding paths.</li>
<li><b>Returns in OSGI Bundle (Sling API)</b>: All the found nodes stored in the Iterator&lt;Resource&gt; object.</li>
<li><b>Returns in OSGI Bundle (JCR API)</b>: The QueryResult object where you can call getNodes() method to get the NodeIterator object.</li>
</ul>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under the &quot;/content/we-retail&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- AND node's navRoot equals to &quot;true&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">as</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span> <br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>navRoot<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> CAST<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;true&quot;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">BOOLEAN</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under the &quot;/content/we-retail&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- AND node's creation date is greater than &quot;April 1st, 2018&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span> <br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>jcr:created<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">&gt;</span> CAST<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;2018-04-01T00:00:00.000Z&quot;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">DATE</span><span style="color: #FF00FF;">&#41;</span><br />
<br />
<span style="color: #808080; font-style: italic;">-- returns all [cq:PageContent] nodes WHERE nodes exist under the &quot;/content/we-retail&quot;</span><br />
<span style="color: #808080; font-style: italic;">-- AND node's maxRating is less than &quot;5.0&quot;</span><br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">as</span> nodes <span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE <span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span><span style="color: #CC0099;">/</span>content<span style="color: #CC0099;">/</span>we<span style="color: #CC0099;">-</span>retail<span style="color: #FF00FF;">&#93;</span><span style="color: #FF00FF;">&#41;</span> <br />
<span style="color: #CC0099; font-weight: bold;">AND</span> nodes.<span style="color: #FF00FF;">&#91;</span>maxRating<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">&lt;</span> CAST<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;5.0&quot;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">DECIMAL</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<div class="mention-block">
<h3>Final Notes: When is the perfect time to use JCR-SQL2?</h3>
<ol>
<li>Build a images and documents search component, if your AEM site that allows consumers to search for images or documents.</li>
<li>Build a blog post search component, If your AEM site has a blog section.</li>
<li>Build a secure resources query API, If you are allowing 3rd party applications to query and find nodes in your AEM site.</li>
</ol>
<p>There&#8217;s many other things to utilize JCR-SQL2 to query nodes, but those are just some quick examples.</p>
</div>
<hr class="spacer-larger" />
<h4 id="jcr-sql2-code-snippets-cheat-sheet">9. JCR-SQL2 Code Snippets Cheat Sheet</h4>
<p>Use these code snippets below to rapidly build your AEM JCR SQL2 search queries, I will try my best to give you some really great examples:</p>
<h5>a. Find all [nt:unstructured] nodes, under the path &#8220;/content/we-retail&#8221;, where the node name = &#8220;root&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:unstructured<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> NAME<span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;root&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>b. Find all components ([nt:unstructured] nodes), under the path &#8220;/content/we-retail&#8221;, where component resourceType = &#8220;weretail/components/content/image&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:unstructured<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>sling:resourceType<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;weretail/components/content/image&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>b. Find all components ([nt:unstructured] nodes), under the path &#8220;/content/we-retail&#8221;, where component resourceType = &#8220;weretail/components/content/image&#8221; AND the fileReference property contains with &#8220;/content/dam/we-retail/en/experiences&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:unstructured<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>sling:resourceType<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;weretail/components/content/image&quot;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #00CC00;">CONTAINS</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span>fileReference<span style="color: #FF00FF;">&#93;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/dam/we-retail/en/experiences&quot;</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>c. Find all [nt:unstructured] nodes, under the path &#8220;/content/we-retail&#8221;,  where the property(&#8220;jcr:title&#8221;) contains &#8220;Featured products&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>nt:unstructured<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #00CC00;">CONTAINS</span><span style="color: #FF00FF;">&#40;</span><span style="color: #FF00FF;">&#91;</span>jcr:title<span style="color: #FF00FF;">&#93;</span><span style="color: #000033;">,</span> <span style="color: #008000;">&quot;Featured products&quot;</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>d. Find all pages (cq:Page nodes), under the path &#8220;/content/we-retail&#8221;,  where the cq:lastModified date is before or equals to &#8220;January 1st, 2000&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> page.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> page<br />
<span style="color: #990099; font-weight: bold;">INNER</span> <span style="color: #990099; font-weight: bold;">JOIN</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> jcrContentNode <span style="color: #990099; font-weight: bold;">ON</span> ISCHILDNODE<span style="color: #FF00FF;">&#40;</span>jcrContentNode<span style="color: #000033;">,</span> page<span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>page<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> jcrContentNode.<span style="color: #FF00FF;">&#91;</span>cq:lastModified<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">&lt;=</span> CAST<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;2023-01-01T00:00:00.000+00:00&quot;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">DATE</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>e. Find all pages (cq:Page nodes), under the path &#8220;/content/we-retail&#8221;,  where the jcr:created date is before to &#8220;July 1st, 2022&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> page.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> page<br />
<span style="color: #990099; font-weight: bold;">INNER</span> <span style="color: #990099; font-weight: bold;">JOIN</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> jcrContentNode <span style="color: #990099; font-weight: bold;">ON</span> ISCHILDNODE<span style="color: #FF00FF;">&#40;</span>jcrContentNode<span style="color: #000033;">,</span> page<span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>page<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> jcrContentNode.<span style="color: #FF00FF;">&#91;</span>jcr:created<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">&lt;</span> CAST<span style="color: #FF00FF;">&#40;</span><span style="color: #008000;">&quot;2022-07-01T00:00:00.000+00:00&quot;</span> <span style="color: #990099; font-weight: bold;">AS</span> <span style="color: #999900; font-weight: bold;">DATE</span><span style="color: #FF00FF;">&#41;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>f. Find all [cq:PageContent] nodes, under the path &#8220;/content/we-retail&#8221;,  where the cq:template equals to &#8220;/conf/we-retail/settings/wcm/templates/hero-page&#8221;</h5>
<p>This AEM JCR SQ2 Query is an example for how to find all nodes with a specific template, results returned as cq:PageContent node.</p>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>cq:template<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;/conf/we-retail/settings/wcm/templates/hero-page&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>g. Find all pages (cq:Page nodes), under the path &#8220;/content/we-retail&#8221;,  where the cq:template equals to &#8220;/conf/we-retail/settings/wcm/templates/hero-page&#8221;</h5>
<p>This AEM JCR SQ2 Query is an example for how to find all nodes with a specific template, results returned as cq:Page node.</p>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #990099; font-weight: bold;">SELECT</span> page.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:Page<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> page<br />
<span style="color: #990099; font-weight: bold;">INNER</span> <span style="color: #990099; font-weight: bold;">JOIN</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> jcrContentNode <span style="color: #990099; font-weight: bold;">ON</span> ISCHILDNODE<span style="color: #FF00FF;">&#40;</span>jcrContentNode<span style="color: #000033;">,</span> page<span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>page<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> jcrContentNode.<span style="color: #FF00FF;">&#91;</span>cq:template<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;/conf/we-retail/settings/wcm/templates/hero-page&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>h. Find all [cq:PageContent] nodes, under the path &#8220;/content/we-retail&#8221;,  where the cq:tags[] contains &#8220;we-retail:gender/men&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">This AEM JCR SQ2 Query <span style="color: #CC0099; font-weight: bold;">is</span> an example for how <span style="color: #990099; font-weight: bold;">to</span> find <span style="color: #990099; font-weight: bold;">all</span> nodes <span style="color: #990099; font-weight: bold;">with</span> a single cq:tags<span style="color: #FF00FF;">&#91;</span><span style="color: #FF00FF;">&#93;</span><span style="color: #000033;">,</span> results returned <span style="color: #990099; font-weight: bold;">as</span> cq:PageContent node.<br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>cq:tags<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;we-retail:gender/men&quot;</span></div></td></tr></tbody></table></div>
<hr class="spacer-medium"/>
<h5>i. Find all [cq:PageContent] nodes, under the path &#8220;/content/we-retail&#8221;,  where the cq:tags[] contains &#8220;we-retail:gender/men&#8221; AND cq:tags[] contains &#8220;we-retail:activity/surfing&#8221;</h5>
<div class="codecolorer-container mysql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="mysql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">This AEM JCR SQ2 Query <span style="color: #CC0099; font-weight: bold;">is</span> an example for how <span style="color: #990099; font-weight: bold;">to</span> find <span style="color: #990099; font-weight: bold;">all</span> nodes <span style="color: #990099; font-weight: bold;">with</span> multiple cq:tags<span style="color: #FF00FF;">&#91;</span><span style="color: #FF00FF;">&#93;</span><span style="color: #000033;">,</span> results returned <span style="color: #990099; font-weight: bold;">as</span> cq:PageContent node.<br />
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> <span style="color: #FF00FF;">&#91;</span>cq:PageContent<span style="color: #FF00FF;">&#93;</span> <span style="color: #990099; font-weight: bold;">AS</span> node<br />
<span style="color: #990099; font-weight: bold;">WHERE</span> ISDESCENDANTNODE<span style="color: #FF00FF;">&#40;</span>node<span style="color: #000033;">,</span> <span style="color: #008000;">&quot;/content/we-retail&quot;</span><span style="color: #FF00FF;">&#41;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>cq:tags<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;we-retail:gender/men&quot;</span><br />
<span style="color: #CC0099; font-weight: bold;">AND</span> <span style="color: #FF00FF;">&#91;</span>cq:tags<span style="color: #FF00FF;">&#93;</span> <span style="color: #CC0099;">=</span> <span style="color: #008000;">&quot;we-retail:activity/surfing&quot;</span></div></td></tr></tbody></table></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #4 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2079905296"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad #5 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="5183553115"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<style>
h5 {
    font-size: 16px;
    font-weight: 100;
}
</style>
<hr class="spacer-larger" />
<h4 id="jcr-sql2-java-code-example-servlet">9. JCR-SQL2 Java Code Example Servlet (2023)</h4>
<p>This is an example of how an AEM servlet would actually utilize the JCR-SQL2 Query with the examples above. It will output a JSON array of the page paths.</p>
<div class="code-1200">
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:400px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.PrintWriter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.Node</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.NodeIterator</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.RepositoryException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.Session</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.query.Query</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.query.QueryManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.jcr.query.QueryResult</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.SlingHttpServletResponse</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.sling.api.servlets.SlingSafeMethodsServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.osgi.service.component.annotations.Component</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.gson.JsonArray</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.google.gson.JsonObject</span><span style="color: #339933;">;</span><br />
<br />
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span>service <span style="color: #339933;">=</span> javax.<span style="color: #006633;">servlet</span>.<span style="color: #006633;">Servlet</span>.<span style="color: #000000; font-weight: bold;">class</span>, property <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;sling.servlet.paths=/bin/getpagedbypath&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GetPagedByPathServlet <span style="color: #000000; font-weight: bold;">extends</span> SlingSafeMethodsServlet <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>SlingHttpServletRequest request, SlingHttpServletResponse response<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Get the JCR session</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Session session <span style="color: #339933;">=</span> request.<span style="color: #006633;">getResourceResolver</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">adaptTo</span><span style="color: #009900;">&#40;</span>Session.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Query statement</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> queryString <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT page.* FROM [cq:Page] AS page &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;INNER JOIN [cq:PageContent] AS jcrContentNode ON ISCHILDNODE(jcrContentNode, page) &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;WHERE ISDESCENDANTNODE(page, '/content/we-retail') &quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;AND jcrContentNode.[cq:lastModified] &lt;= CAST('2023-01-01T00:00:00.000+00:00' AS DATE)&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Create the query object</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QueryManager queryManager <span style="color: #339933;">=</span> session.<span style="color: #006633;">getWorkspace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getQueryManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Query query <span style="color: #339933;">=</span> queryManager.<span style="color: #006633;">createQuery</span><span style="color: #009900;">&#40;</span>queryString, Query.<span style="color: #006633;">JCR_SQL2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Execute the query</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; QueryResult result <span style="color: #339933;">=</span> query.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Get the nodes from the query result</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NodeIterator nodeIterator <span style="color: #339933;">=</span> result.<span style="color: #006633;">getNodes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Collect the paths of the first ten pages in a list</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">&gt;</span> pagePaths <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>nodeIterator.<span style="color: #006633;">hasNext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node pageNode <span style="color: #339933;">=</span> nodeIterator.<span style="color: #006633;">nextNode</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> pagePath <span style="color: #339933;">=</span> pageNode.<span style="color: #006633;">getPath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pagePaths.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>pagePath<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Create a JSON object to hold the results</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JsonObject jsonResponse <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JsonObject<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JsonArray resultsArray <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JsonArray<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add the paths to the JSON array</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> path <span style="color: #339933;">:</span> pagePaths<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; resultsArray.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>path<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Add the JSON array to the response object</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; jsonResponse.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;results&quot;</span>, resultsArray<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Set the response content type</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Write the JSON response to the output</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">PrintWriter</span> writer <span style="color: #339933;">=</span> response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.<span style="color: #006633;">print</span><span style="color: #009900;">&#40;</span>jsonResponse.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; writer.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>RepositoryException e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Handle exception</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">setStatus</span><span style="color: #009900;">&#40;</span>SlingHttpServletResponse.<span style="color: #006633;">SC_INTERNAL_SERVER_ERROR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; response.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error executing query: &quot;</span> <span style="color: #339933;">+</span> e.<span style="color: #006633;">getMessage</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</div>
<p><strong>JSON response</strong></p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;"><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #0000ff;">&quot;results&quot;</span><span style="color: #339933;">:</span><span style="color: #009900;">&#91;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page1&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page2&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page3&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page4&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page5&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page6&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page7&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page8&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page9&quot;</span>,<br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;/content/we-retail/page10&quot;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#93;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><strong>Curl call</strong></p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap;">curl -X GET http://localhost:4502/bin/getpagedbypath</div></td></tr></tbody></table></div>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet">How to use AEM JCR SQL2 query strings to query for nodes in Java Content Repository</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/aem-jcr-sql2-tutorial-and-examples-and-cheatsheet/feed</wfw:commentRss>
			<slash:comments>26</slash:comments>
		
		
			</item>
		<item>
		<title>What is the AEM Apache Sling Referrer Filter OSGI configuration?</title>
		<link>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration</link>
					<comments>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration#respond</comments>
		
		<dc:creator><![CDATA[briankasingli]]></dc:creator>
		<pubDate>Sun, 01 Apr 2018 14:09:51 +0000</pubDate>
				<category><![CDATA[AEM]]></category>
		<category><![CDATA[Quick Reference]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://sourcedcode.com/?p=53</guid>

					<description><![CDATA[<p>AEM &#8220;referrer not allowed&#8221; Out of the box, AEM denies all server names or hosts to make HTTP request to the respective running AEM publish/author instance. During a HTTP request made to the AEM publish/author, AEM checks the Referrer header configuration. If the referrer configured to allow the host(s), then AEM will full-fill the request, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration">What is the AEM Apache Sling Referrer Filter OSGI configuration?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p style="color:red; text-align:center;">AEM &#8220;referrer not allowed&#8221;</p>
<p>Out of the box, AEM denies all server names or hosts to make HTTP request to the respective running AEM publish/author instance. During a HTTP request made to the AEM publish/author, AEM checks the Referrer header configuration. If the referrer configured to allow the host(s), then AEM will full-fill the request, and if not, the AEM &#8220;referrer not allowed&#8221; error message will be shown.</p>
<p>Take an example of an AEM application exposes an servlet that exposes the endpoint of &#8220;/bin/stores.js&#8221;. This endpoint will return an array of store detail JSON objects. This feature will be reusable, so throughout the AEM application, on many occasions, the endpoint is being used to render HTML elements to the page using javascript. Now take an example of a microsite within the same organisation of <u>m.site.com</u> (mobile site) where it would like to consume &#8220;/bin/stores.js&#8221;. When the micro-site make a HTTP GET request on &#8220;/bin/stores.js&#8221;, you will get the AEM &#8220;referrer not allowed&#8221; error because the host (or m.site.com) referrer is not allowed; we must allow m.site.com in the Apache Sling Referrer Filter settings.</p>
<hr class="spacer-large"/>
<div class="mention-block"><b>What is an &#8220;HTTP Referrer header&#8221;?</b> The HTTP Referrer header identifies the address of the webpage who&#8217;s making a request. We can use this information to allow specific hosts to fulfill the HTTP request.<br />
    <br />Read More: <a href="https://en.wikipedia.org/wiki/HTTP_referer" rel="noopener noreferrer" target="_blank">https://en.wikipedia.org/wiki/HTTP_referer</a></div>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- Horizontal Preview Ad --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="8658919803"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>In OSGI Configurations in AEM (<a href="http://localhost:4502/system/console/configMgr" target="_blank" rel="noopener noreferrer">http://localhost:4502/system/console/configMgr</a>) use the browser finder (CTRL + F) and find &#8220;Apache Sling Referrer Filter&#8221;. Click on the configuration, and let&#8217;s break it down to see what fields control what.</p>
<h3>Breaking things down</h3>
<p><img loading="lazy" decoding="async" class="alignnone size-large wp-image-55" src="http://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-1024x654.png" alt="" width="1024" height="654" srcset="https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-1024x654.png 1024w, https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-300x191.png 300w, https://sourcedcode.com/wp-content/uploads/2018/04/apache-sling-referrer-osgi-setttings-default-768x490.png 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></p>
<ul>
<li><b>Allow Empty (Boolean)</b>: only enable this if you are testing (using a REST Client). Enabling this will allow any hosts to make requests to your AEM application (remember to turn this off in your production environment).</li>
<li><b>Allow Hosts (String[])</b>: allows specific hosts to make requests to your AEM instance; use string characters only.</li>
<li><b>Allow Regexp Host (String[])</b>: allows specific hosts to make requests your AEM instance; use regex only.</li>
<li><b>Filter Methods (String[])</b>: defines which HTTP method(s) will be checked with the values in the allowed hosts before accepting incoming HTTP requests.</li>
</ul>
<div class="mention-block">
<strong>Quick Note:</strong><br />
If you are learn by doing, you can follow the &#8220;How to make a simple HTTP post request in AEM&#8221; tutorial blog, where this tutorial will put the AEM Apache Sling Referrer Filter OSGI configuration in practice. <a href="https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client">https://sourcedcode.com/how-to-make-simple-http-post-methods-in-aem-with-a-http-rest-client</a>.
</div>
<p><!-- Horizontal Preview Ad #2 --><br />
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-9053803095882933"
     data-ad-slot="2263738126"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>The post <a rel="nofollow" href="https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration">What is the AEM Apache Sling Referrer Filter OSGI configuration?</a> appeared first on <a rel="nofollow" href="https://sourcedcode.com">Sourced Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sourcedcode.com/blog/aem/in-aem-what-is-the-apache-sling-referrer-filter-osgi-configuration/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
