Hi @sasi1,
I would manage this with the implementation of Sling Model, Kindly refer below code.
Sling Model
@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class DemoModel {
@Inject private String textfieldA;
@Inject private String textfieldB;
public String getTextfieldA() { returntextfieldA; }
public String getTextfieldB() { returntextfieldB; }
}
HTL
<sly data-sly use.model="com.models.DemoModel" />
<div>${model.textfieldA}></div>
<div data-sly-test="${!model.textfieldA}">${model.textfieldB}></div>
or you can use HTL directly as below
<div>
<div>${properties.textfieldA}></div>
<div data-sly-test="${!properties.textfieldA}">${properties.textfieldB}></div>
</div>
Hope that helps!
Regards,
Santosh