我有这个很奇怪的错误使用h:graphicImage的没有得到像在H:graphicImage的JSF中
此代码工作正常: -
<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;
}
}
嗨Bozho, 问题是不实际的#或者$。我找到了自己的问题的答案。其实我需要把双斜杠,它的工作:) 私人静态字符串commonImageFolderPath =“// Common // Images //”; – TCM 2010-03-31 10:54:03
确实很奇怪。 – Bozho 2010-03-31 11:05:27