rich:insert component allows to insert and, optionally, format the file from the application context into the page. The context relative path to the file is specified with src attribute.

highlight attribute defines the type of a syntax highlighting. If this attribute is specified, inserting text is formated and keywords are colorized using jhighlight open source library. You need to have jhighlight.jar in the classpath to have this feature enabled. The following example shows the groovy code snippet inserted and highlighted:

Groovy code snippet page integration example

errorContent attribute defines the alternative content that will be shown in case 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.