Skip to content

Instantly share code, notes, and snippets.

View myChildPage.jsp
<%@include file="/libs/foundation/global.jsp" %>
<!-- Load the sidekick only when viewing issue page on its own -->
<% if(currentPage.getPath().equals(resourcePage.getPath())) { %>
<cq:include script="/libs/wcm/core/components/init/init.jsp"/>
<% } %>
View pageContainer.jsp
<!-- Code snippet to inject all child pages into current page -->
<%
Iterator<Page> childPages = resourcePage.listChildren();
while (childPages.hasNext()) {
Page childPage = childPages.next();
String childPageUrl = childPage.getPath() + ".html";
%>
<sling:include path="<%= childPageUrl %>" />
<% } %>
View myPage.jsp
<%@include file="/libs/foundation/global.jsp" %>
<cq:include path="myComponent" resourceType="matelli/components/content/myComponent" />
<%
/** Option 1: Simply direct reference */
//String componentPath = "/content/myPage/jcr:content/myComponent"; //path to component
//Node node = resourceResolver.getResource(componentPath).adaptTo(Node.class);
//String title = node.getProperty("jcr:title").getString();
//String text = node.getProperty("jcr:text").getString();
View myComponent.jsp
<%@include file="/libs/foundation/global.jsp"%>
<%
String title = properties.get("jcr:title", "default title");
String text = properties.get("jcr:text", "default text");
//String title = properties.get("jcr:title", String.class); //defaults to null
%>
Title: <%= title %> <br/>
View mailchimpComponent.jsp
<%@include file="/apps/cardinal/global.jsp"%>
<%@ page import="com.ecwid.mailchimp.*,
com.ecwid.mailchimp.method.list.*" %><%
%>
<%
String apikey = currentStyle.get("apikey", "null");
String listid = properties.get("listid", "null");
MailChimpClient mailChimpClient = new MailChimpClient();
ListsMethod listsMethod = new ListsMethod();