myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Style Sheet" by MarioIvankovits
Date Wed, 24 Jan 2007 13:03:35 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by MarioIvankovits:
http://wiki.apache.org/myfaces/Style_Sheet

------------------------------------------------------------------------------
  <f:view>
    <t:document>
      <t:documentHead>
-       <t:stylesheet path="#{applicationSkin.stylesheet"">
+       <t:stylesheet path="#{applicationSkin.stylesheet}">
      </t:documentHead>
      ....
    <t:document>
@@ -21, +21 @@

   * EL can be used, as in the example above.  By getting the stylesheet from a managed bean,
it can be set, and changed, at runtime to allow the user interface to dynamically be ''skinned''.
   * Stylesheet must start with a slash, i.e. {{{/stylesheet.css}}} or be a fully qualified
url, i.e. {{{http://foo.com/stylesheet.css}}}
  
+ 
+ ==== filtered stylesheet ===
+ 
+ {{{
+ <f:view>
+   <t:document>
+     <t:documentHead>
+       <t:stylesheet path="/context/path/to/stylesheet.css" filtered="true">
+     </t:documentHead>
+     ....
+   <t:document>
+ </f:view>
+ }}}
+ 
+ The filtered attribute allows you to direct the tag to filter the real stylesheet and replace
every EL string within.
+ 
+ One use case .... hmmm ... the only one I had in mind when doing this enhancement is to
keep the context path for background-images dynamic.
+ 
+ Given your stylesheet.css contains the following text
+ 
+ {{{
+ .tableBack
+ {
+ 	background-image: url(#{environmentInfo.requestContextPath}/images/logo.jpg)
+ }
+ }}}
+ 
+ and you have configured a managed bean called "environmentInfo" the EL will be replaced
by the return value of the beans method. (Notice: A simple .toString() will be issued on the
return value as JSF do not allow to use converters without an component).
+ 
+ The filtering will happen only on the first access of the stylesheet. Any subsequent access
will just deliver a cached result. Means: You can not interweave any request specific stuff
in your stylesheet. This make no sense as then you can simply embed the stylesheet into the
page.
+ 

Mime
View raw message