ui:composition template ="< jar from jar>" [英] ui:composition template="<template from jar>"
问题描述
我想将JSF的Facelets模板文件放在JAR文件中。
I would like to place the Facelets template file for JSF in a JAR file.
我试图通过EL引用它作为
I tried to reference it by EL as
<ui:composition template="#{resource['templates:template_pe_layout.xhtml']}">
适用于CSS或图像,但不适用于合成模板。
which works perfect for CSS or images, but not for the composition template.
我怎样才能达到目标?
推荐答案
#{资源}
表达式最初设计为仅使用内部 CSS文件
The #{resource}
expression is initially designed for use inside CSS files only like so
.someclass {
background-image: url(#{resource['somelibrary:img/some.png']});
}
不打算在中使用< h: outputStylesheet>
,< h:outputScript>
或< h:graphicImage>
应该使用如下:
It's not intented for usage in <h:outputStylesheet>
, <h:outputScript>
or <h:graphicImage>
which should rather be used as follows:
<h:outputStylesheet library="somelibrary" name="css/some.css" />
<h:outputScript library="somelibrary" name="js/some.js" />
<h:graphicImage library="somelibrary" name="img/some.png" />
关于模板,只需指定完整的 / META-INF /资源
那里的相对路径。
As to the templates, just specify the full /META-INF/resources
relative path in there.
<ui:composition template="/templates/template_pe_layout.xhtml">
参见:
- 在JAR中打包Facelets文件(模板,包含,复合)
- 将JSF前缀更改为后缀映射会强制我重新应用CSS背景图像上的映射
- Packaging Facelets files (templates, includes, composites) in a JAR
- Changing JSF prefix to suffix mapping forces me to reapply the mapping on CSS background images
See also:
这篇关于ui:composition template ="< jar from jar>"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!