我将实现这样的$ {context:layout / images / $ {itemProperty.signImage} .png}。但是我收到了以下错误
Could not convert 'context:layout/images/${itemProperty.signImage' into a component parameter binding: Unable to locate asset 'context:layout/images/${itemProperty.signImage' (the file does not exist). [at classpath:net/web/app/sample/pages/Test.tml, line 30].
请任何人说我怎样才能实现。
答案 0 :(得分:3)
您不能在上下文表达式中使用表达式。但您可以通过AssetSource服务获取资产:
@Inject
private AssetSource assetSource;
public Asset getSignImage() {
final String path = "layout/images/" + itemProperty.getSignImage() + ".png";
return assetSource.getContextAsset(path, null);
}