0
@Inject
String getGoToFavoritesButtonLink();

is in the interface and not class. I want to modify its value to be something like getGoToFavoritesButtonLink().concat(".html"); so that URL can be externalized. How can this be done without any setter?

Java:

@Model(adaptables = org.apache.sling.api.resource.Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL) 
public interface WebshopFavoriteListConfigModel {
@Inject 
String 
getGoToFavoritesButtonLink();
}

HTML:

<a href="${model.webshopFavoriteListConfigModel.goToFavoritesButtonLink}"/>
Tadija Malić
  • 445
  • 7
  • 26
Rashmi Ks
  • 35
  • 8

1 Answers1

0

You can set the extension using the extension HTL option:

<a href="${model.webshopFavoriteListConfigModel.goToFavoritesButtonLink @ extension='html'}">...</a>

You can review all URI manipulation options in the HTL Specification.

Vlad
  • 10,602
  • 2
  • 36
  • 38