【发布时间】:2010-03-31 09:44:30
【问题描述】:
我在 h:graphicImage 中遇到了这个非常奇怪的错误
这段代码运行良好:-
<h:graphicImage value="/Common/Images/#{item.templatePicName}"/>
而这个没有:-
<h:graphicImage alt="${app:getCommonImagePath(item.templatePicName)}" value="${app:getCommonImagePath(item.templatePicName)}" />
它只显示 alt 值 /Common/Images/Sunset.jpg 非常好,适用于第一种情况。那为什么它在第二种情况下不起作用?我的图像没有问题。它们存在于正确的目录中。
这里的getCommonImagePath是我自定义的EL函数,它的定义是:
package Common;
public final class AppDeployment {
private AppDeployment(){ //hide constructor
}
private static String commonImageFolderPath = "/Common/Images/";
public static String getCommonImagePath(String picName){
return commonImageFolderPath + picName;
}
}
【问题讨论】: