2

h:graphicImageを使用して、name属性を使用して画像を表示しています。さて、 PrettyPhoto(JQuery実装)を正常に実装するには、結果/javax.faces.resource/pictures/file.png.xhtmlとして画像()へのパスが必要になります<a href />

PrettyPhotoのドキュメントの抜粋からわかるように、画像へのパスが自分のパスとして必要になります<a href />(サムネイルを使用しているため、実際には違いがあります)。

<a href="images/fullscreen/2.jpg" rel="prettyPhoto" title="This is the description">
    <img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="This is the title" />
</a>

私のresourceName(の名前が付けられているh:graphicImage)を抽出する方法はありますh:outputLinkか?

4

1 に答える 1

12

暗黙的なEL変数マッパー#{resource}を使用して、JSFリソースライブラリ/名前を完全なURLに変換できます。

だから、あなたの特定のケースでは、

<h:outputLink value="#{resource['images/fullscreen/2.jpg']}">
    <h:graphicImage name="images/thumbnails/t_2.jpg" />
</h:outputLink>

リソースライブラリも使用している場合、構文は次のようになります。

<h:outputLink value="#{resource['default:images/fullscreen/2.jpg']}">
    <h:graphicImage library="default" name="images/thumbnails/t_2.jpg" />
</h:outputLink>

<a href>(の代わりに使用することもできます<h:outputLink value>

于 2012-11-07T22:12:01.143 に答える