sightly

How to call Sling Model Method with input parameter AEM

六眼飞鱼酱① 提交于 2020-04-07 09:16:12
问题 I am having a scenario in which i want to call a sling model with input parameter. For this i have a code like this <div data-sly-use.model3="${'com.bhf.aem.sling.models.Test' @ colour='red'}"> </div> But I want to call a method in sling model twice with two different parameters .Is it possible with sling models? Any Help!!! 回答1: From AEM 6.3 there is a new HTL feature that allows to do this. In the data-sly-include and data-sly-resource you can now pass requestAttributes in order to use them

Sightly Implicit Objects

故事扮演 提交于 2019-12-25 02:45:12
问题 I am trying to implement my own version of WCM's navigation component, whose logic can be found here, subbing my own logic instead: import java.util.*; import com.day.cq.wcm.api.Page; import com.day.cq.wcm.api.PageFilter; import com.adobe.cq.sightly.WCMUsePojo; public class Navigation extends WCMUsePojo{ private Iterator<Page> items; @Override public void activate() throws Exception { Page navRootPage = getCurrentPage().getAbsoluteParent(2); items = navRootPage.listChildren(new PageFilter());

How to display values in a List of a SlingModel using Sightly

拈花ヽ惹草 提交于 2019-12-24 17:16:13
问题 I am not able to display values in a lit that are part of a POJO/SlingModel. Please help. Desired Output Commodity 1 Product 1, Product 2, Product 3 Commodity 2 Product 2, Product 4, Product 5 Sightly Code <!-- LIST :: SLING MODEL -- FINAL --> <div data-sly- use.model="${'com.tti.tticommons.service.models.LeadTimeTrendsModel' @ rawJson=ws.JSON}" data-sly-unwrap> <div data-sly-list.commodity="${model.getProductsList}"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class=

AEM Sightly to get properties of child nodes.

别等时光非礼了梦想. 提交于 2019-12-23 03:11:41
问题 So it looks like sightly is great for getting properties, but I would like to work get properties of other child nodes that I have defined. Here is the start of my PictureFill Component structure: { jcr:primaryType: "nt:unstructured", jcr:createdBy: "admin", fileReference: "/content/dam/myapp/dev/hero-billboard.jpg", jcr:lastModifiedBy: "admin", jcr:created: "Wed Oct 07 2015 03:38:00 GMT+0000", jcr:lastModified: "Wed Oct 07 2015 16:54:12 GMT+0000", sling:resourceType: "myapp/components

AEM sightly how to reuse variables

…衆ロ難τιáo~ 提交于 2019-12-22 18:04:10
问题 can I use variables in another file that I'm including? in my HTL (file1.html) I have: <sly data-sly-test.myVar="${properties.myVarFromDialog}"></sly> <sly data-sly-include="/file2.html"></sly> Can I use myVar in file2.html ? I'm not getting any value. Is there a way of getting that value from file1.html to use in file2.html 回答1: You should use data-sly-template for this. You can define templates in a separate file and can pass in parameters. For an explanation on templates check the

Iteration (for loop) in sightly

北战南征 提交于 2019-12-22 06:28:15
问题 I had used <c:forEach> in jstl. Now i want to use sightly. My usecase is to print numbers from 1 to 10 then how can i iterate in sightly as for loop in java 回答1: Sightly doesn't let you put any logic in it by design. What you should do is, you should customize your underlying model so that you can retrieve a prepared list of irrelevant (from Sightly's perspective) length that contains data that needs to be displayed. After that, just use data-sly-list . You'll need to google for more details,

How to create a radio button in aem 6 touch dialog

梦想的初衷 提交于 2019-12-21 19:58:17
问题 I am having a touch UI component for which I am creating a dialog in AEM 6. I have a requirement to create 2 radio buttons in the touch dialog and if either one of them are selected, the corresponding value of the selected radio button should be displayed. however, I am not understanding how to create the radio button options. I have implemented the same in classic dialog where the xtype=selection and type=radiogroup is used, but I do not understand how to create it in touch dialog 回答1: You

Expression Option Sightly

白昼怎懂夜的黑 提交于 2019-12-20 10:27:18
问题 I was looking over the expression options used in sightly. I tried the below line of code, but it seems just render the text over the page, can someone provide use of options with some good examples. ${'Assets' @ i18n, locale='fr-CH', hint='Translation Hint'} ${'Page {0} of {1}' @ format = [count,total] } I have tried and understand the below code to include the parsys <div data-sly-resource ="${@path='question_list', resourceType='wcm/foundation/components/parsys'}"></div> Also from where i

Sightly jstl c:set analog

夙愿已清 提交于 2019-12-14 02:44:58
问题 On jsp I can write following code: <c:set var="salary" value="${object.salary}"/> and then in code I can use ${salary} variable Can you help to rewrite it using sightly? P.S. I tried this: <div data-sly-use.salary="MySalary"> <div data-sly-use.product="MyBean" data-sly-unwrap> { <ul data-sly-list="${product.specifications}" data-sly-unwrap> "${item.sku ? item.sku : 'product'}" : "${item.label} ${item.value}"<div data-sly-test="${!itemList.last}" data-sly-unwrap>,</div> </ul> } </div> </div>

currentStyle.<propertyName> is returning null in cq5 publisher, which is working perfectly fine in author

白昼怎懂夜的黑 提交于 2019-12-13 07:59:33
问题 I am using sightly to access the design dialog properties for a component. something like <span data-sly-test="${currentStyle.delimiter}">${currentStyle.delimiter}</span> but all I am getting is an empty string. I tried to resolve the issue by trying out the following. Activating the design node Deleting the page and creating a new page. Deleting components and dragging and dropping the component again on the page. I checked the JSON output of currentDesign and all the values am trying to