6.14.6. < rich:insert > available since 3.1.0

### 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.14.6. < rich:insert > available since 3.1.0

expand all

#### 6.14.6.1. Description

The <rich:insert> component is used for highlighting, source code inserting and, optionally, format the file from the application context into the page.

#### 6.14.6.2. Key Features

- Source code highlighting

- Variety of formats for source code highlighting

#### 6.14.6.3. Details of Usage

The are two basic attributes. The "src" attribute defines the path to the file with source code. The "highlight" attribute defines the type of a syntax highlighting.

If "highlight" attribute is defined and JHighlight open source library is in the classpath, the text from the file is formated and colorized.

An example is placed below:

    <rich:insert  src="/pages/sourcePage.xhtml" highlight="xhtml"/>

The result of using <rich:insert> component is shown on the picture:

Figure 6.184. Source code highlighting with the help of <rich:Insert>>

The <rich:insert> component provides the same functionality as JHighlight. Thus, all names of highlight style classes for source code of particular language could be changed to your names, which are used by the JHighlight library.

The "errorContent" attribute defines the alternative content that will be shown in case the <rich:insert> cannot read the resource defined with "src" attribute. If "errorContent" attribute is not defined, the component shown the actual error message in the place where the content is expected.

#### 6.14.6.4. Reference Data

Table of <rich:insert> attributes.

Table 6.253. Component Identification Parameters

Name | Value
--- | ---
component-type | org.richfaces.ui.Insert
component-class | org.richfaces.ui.component.html.HtmlInsert
component-family | org.richfaces.ui.Insert
renderer-type | org.richfaces.ui.InsertRenderer
tag-class | org.richfaces.ui.taglib.InsertTag

#### 6.14.6.5. Relevant Resources Links

Visit the Insert page at RichFaces LiveDemo for examples of component usage and their sources.

- Prev6.14.5. < rich:hotKey > avai...
- Top of page
- Front page
- Next6.14.7. <rich:message> available since...