JBoss.orgCommunity Documentation
The <a4j:loadStyle> component allows to load a style sheet file from alternative sources like a jar file, etc. It inserts stylesheet links to the head element.
Table 6.33. a4j : loadStyle attributes
Table 6.34. Component identification parameters
Name | Value |
---|---|
component-type | org.ajax4jsf.LoadStyle |
component-family | org.ajax4jsf.LoadStyle |
component-class | org.ajax4jsf.component.html.HtmlLoadStyle |
renderer-type | org.ajax4jsf.LoadStyleRenderer |
To create the simplest variant on a page use the following syntax:
Example:
<a4j:loadStyle src="styles/style.css"/>
Example:
import org.ajax4jsf.component.html.HtmlLoadStyle;
...
HtmlLoadScript myStyle = new HtmlLoadStyle();
...
The main attribute of the
<a4j:loadStylet>
is
"src"
, wich defines the context relative path to the script.
The value of the attribute does not require a prefix of an application.
Leading slash in the path means the root of the web context.
It is also possible to use resource:///
prefix to access the script file using RichFaces resource framework.
Example:
<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />
The
"src"
attribute passses value to the getResourceURL()
method of the ViewHandler of the application,
The result is passed through the encodeResourceURL()
method of the ExternalContext.
Vizit the Script page at RichFaces LiveDemo for examples of component usage abd their sources.