如何在接口中修改@Inject getter(从AEM传递)

时间:2019-03-03 11:00:02

标签: java aem-6 htl

@Inject
String getGoToFavoritesButtonLink();

在接口中,而不是类。我想将其值修改为getGoToFavoritesButtonLink().concat(".html");,以便可以将URL外部化。没有任何二传手怎么办?

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}"/>

1 个答案:

答案 0 :(得分:0)

您可以使用extension HTL选项设置扩展名:

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

您可以查看所有URI manipulation options in the HTL Specification