My component library directory tree is setup as the following:
resources
mylib
css
mycomponent.css
properties
mycomponent.properties
mycomponent.xhtml
I'd like to load the properties file within mycomponent.xhtml to use for messages. What is the proper way of doing this? Is there an f:loadbundle type of solution?
答案 0 :(得分:4)
复合材料通过#{cc.resourceBundleMap}
隐式支持资源包。这只是要求:
所以,如果你重组一下,
WebContent
|-- resources
| `-- mylib
| |-- mycomponent.css
| |-- mycomponent.properties
| `-- mycomponent.xhtml
:
然后您应该可以按如下方式访问它:
<cc:implementation>
<h:outputStylesheet library="mylib" name="mycomponent.css" />
...
<p>Property with key "foo": #{cc.resourceBundleMap.foo}</p>
<p>Property with key "foo.bar": #{cc.resourceBundleMap['foo.bar']}</p>
</cc:implementation>