Converting jsp to HTL

Avatar

Avatar

srikanthg212933

Avatar

srikanthg212933

srikanthg212933

22-09-2020

Hi I am trying to convert my existing jsp to htl. I am stuck at preparing valuemapresource which was included in jsp like below

ValueMap vm= new ValueMapDecorator(new HashMap<>());
vm.put("granite:class", "classname");
vm.put("value", value);
vm.put("name", name);
vm.put("text", text);
ValueMapResource valueMapResource = new ValueMapResource(resourceResolver, resource.getPath(), "granite/ui/components/coral/foundation/form/checkbox", vm);
<sling:include resource="<%= valueMapResource %>"/>

 I wanted to convert this above snippet to HTL using data-sly-resource. could you let me know how can i be able to prepare this similar resource in htl.

htl jsp
View Entire Topic

Avatar

Avatar

raj_mandalapu

Avatar

raj_mandalapu

raj_mandalapu

22-09-2020

You need to create a java class for this. if you are looking to populate dropdown then the below article may help you.

http://www.coderss.in/how-to-create-dropdown-dynamically-using-granite-datasource-object-in-aem-6-3/