Field is an abstract component that is extended by the actual field implementation, such as textfield. It is created to make creating a form field easier. It handles:

  • field label and field description
  • read-only mode
  • root field (com.adobe.granite.ui.components.ComponentHelper.Options#rootField)

Life Cycle

It will call the following scripts in order:

This script needs to set a ValueMap to the request attribute, like so request.setAttribute(com.adobe.granite.ui.components.Field.class.getName(), vm);. The value map needs to contain at least property named value that is storing the value of the field. The implementor is free to put any property to this map, though it is encouraged to namespace the property name to avoid future conflict. By default Field is giving default implementation of init.jsp, setting the value to of value property of type StringEL. This map is also available during the calling of render.jsp.

This is where the actual rendering of the actual field is performed.

At this point the field also set labelId key to ValueMap described at init.jsp. This labelId is used to set the id attribute of the label. The actual field should make use of this labelId to set the appropriate ARIA attribute (e.g. aria-labelledby) accordingly.

Read-only Mode


The read-only mode is deprecated.

This feature is enabled by setting renderReadOnly property to true. The read-only version of the component is rendered by including the read-only resource type. Consult com.adobe.granite.ui.components.ComponentHelper#getReadOnlyResourceType for details. If read-only resource type is not available, no read-only version is rendered. The value set during init.jsp will be inspected to check if it is empty. If it is empty the read-only mode will be hidden, unless showEmptyInReadOnly property is set to true in the content.

Content Structure

  1. granite:commonAttrs
  2. granite:renderCondition

The label of the component.


I18n comment for the label of the component.


The description of the component.


Renders the read-only markup as well.


The read-only mode is deprecated.


Shows read-only version even when it has empty value or unchecked.


The read-only mode is deprecated.


true to hide the whole field (including the wrapper); false otherwise.


The class for the wrapper element.

  1. left
  1. right
  2. left
  3. top
  4. bottom

The position of the tooltip relative to the field. Only used when fieldDescription is set.