问题
I know that by using <f:loadBundle>
I can load whole property file. But is there any tag in Facelets by which I can define a property in Facelets file and can use in Facelets page.
I know this can also be done by controller layer (like getSomeProperty()
) but I don't want to do this. I am just looking for a tag that do this.
In other words we can do this in XML like this
<properties>
<propertyName>propertyValue</propertyName>
<proprties>
So in Facelets how can I do this?
回答1:
Just define a vanilla page-scoped variable using either JSTL. Using JSTL's <c:set/>:
<c:set var="propertyName" value="propertyValue"/>
You could then use #{propertyName}
anywhere within your page.
来源:https://stackoverflow.com/questions/27981258/define-a-property-in-facelets-page