Enabling the Rich Text Editor in Custom JSPs

If you use configurable forms and structure browser, the rich text editor feature is automatically enabled for any attribute defined as multiline, and can be configured for other attributes. For custom JSPs, though, you need to explicitly enable the feature. To configure an attribute for rich text editing in a configurable form or structure browser, see Managing Rich Text Editing.

Custom JSP pages can enable rich text editing in two ways:

This task shows you how to:

Enable RTE Using Regular Attribute Expressions

The custom JSP must include the calls and processing described in these steps.

  1. Include the RTE file using this syntax:

    <%@include file = "../common/emxRTE.inc" %>

  2. Fetch the value for the textarea:

    UIRTEUtil.getAttributeData (context, ObjectId, attributeName);

    This call returns a map that contains attributeValue and a boolean isRTEEnabled.

  3. If the Boolean returned is true, change or add the class attribute for the textarea:

    <textarea class="rte">

    Use the value from the map in the textarea.

  4. To set text area attributes, use:

    UIRTEUtil.setAttribute(context, objectId, attrbuteName, attributeValue)

Enable RTE Using an _RTE Attribute

  1. Include the RTE file using this syntax:

    <%@include file = "../common/emxRTE.inc" %>

  2. Fetch the value for the textarea from the _RTE attribute.

  3. Change or add the class attribute for the textarea:

    <textarea class="rte">

  4. Set the value of the _RTE attribute from the textarea.