### Create new RichFaces Documentation Jira issue

Summary
255 characters left
Description
Environment
This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.org Community Documentation

- Prev
- Next

### 6.2.4. < a4j:loadStyle > available since 3.0.0

expand all

#### 6.2.4.1. Description

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.32. a4j : loadStyle attributes

Attribute Name | Description
--- | ---
binding | JSF: The attribute takes a value-binding expression for a component property of a backing bean
id | JSF: Every component may have a unique id that is automatically created if omitted
media | This attribute defines the device to which it is necessary to apply style registration. The possible values are "all", "screen" (by default), "print", "projection", "projection", "braille" and "speech".
rendered | JSF: If "false", this component is not rendered
src | Defines the context relative path to the style sheet file.

Table 6.33. 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

#### 6.2.4.2. Creating the Component with a Page Tag

To create the simplest variant on a page use the following syntax:

Example:

    <a4j:loadStyle src="styles/style.css"/>

#### 6.2.4.3. Creating the Component Dynamically Using Java

Example:

    import org.ajax4jsf.component.html.HtmlLoadStyle;

    ...

    HtmlLoadScript myStyle = new HtmlLoadStyle();

    ...

#### 6.2.4.4. Details of usage

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.

#### 6.2.4.5. Relevant resources links

Vizit the Script page at RichFaces LiveDemo for examples of component usage abd their sources.

- Prev6.2.3. < a4j:loadScript > ...
- Top of page
- Front page
- Next6.3. Ajax Validators