Avatar

Correct answer by
Community Advisor

@brijesht7477132 

In order to avoid additonal code for datasource servlet/ sling model.

We can use cq:template node to set initial default values for any kind of select datasource, textfield, radiogroup, checkbox etc. resource type.

Just add cq:teamplte node inside AEM component.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0"
jcr:primaryType="nt:unstructured"
<jcrPropertyName>="<default value here>"/>

 

View solution in original post