Adding sub tags to a JSF page

A number of JSF tags have special child tags (sub tags) used to specify options.

  1. Create a JSF enabled dynamic Web project.

  2. Create a JSF page.

  3. Add the parent tag. For more information about adding JSF components, refer to Adding JSF components to Web pages.

The method by which sub tags are added to a component varies based on the subtag.

The available sub tags are:

Table 1. Adding sub tags to a JWL JSF component
Sub tag component1 Sub tag Description Parent tags How is component added to a page?
Attribute <f:attribute> Adds an attribute (name/value pair) to a parent tag.

  • <h:dataTable>

  • <h:column>
In the JSP Source editor, type <f:attribute /> before the closing parent tag.
Convert Date/Time <f:convertDateTime> Convert a DateTime from a string to a value and vice versa.

  • <h:inputText>

  • <h:inputMiniCalendar>

  • <h:ouputText>

Select

Date/Time in the

Format list in the Properties view for the parent tag.

To configure the f:convertDateTime sub tag, right-click the

f:convertDateTime sub tag in the JSP source editor and select

Properties.

Convert Date/Time (ICU4J) <hx:convertDateTime> Extension of the standard <f:convertDateTime> that uses ICU4J in it's implementation instead of the Java util classes.

  • <h:inputText>

  • <h:inputMiniCalendar>

  • <h:ouputText>

Select

Date/Time in the

Format list in the Properties view for the parent tag.

To configure the hx:convertDateTime sub tag, right-click the

hx:convertDateTime sub tag in the JSP source editor and select

Properties.

Note: This component is only available on the Enhanced Faces Components drawer of the palette.

Convert Masked String <hx:convertMask> Convert a formatted (masked) string to a value and vice versa.

  • <h:inputText>

  • <h:ouputText>

Select

Mask from the

Format list.

To configure the hx:convertMask sub tag, right-click the

hx:convertMask sub tag in the JSP source editor and select

Properties.

Convert Number <f:convertNumber> Convert a Number from a string to a value and vice versa.

  • <h:inputText>

  • <h:ouputText>

Select

Number from the

Format list.

To configure the f:convertNumber sub tag, right-click the

f:convertNumber sub tag in the JSP source editor and select

Properties.

Convert Number (ICU4J) <hx:convertNumber> Extension of the standard <f:convertNumber> that uses ICU4J in it's implementation instead of the Java util classes.

  • <h:inputText>

  • <h:ouputText>

Select

Number from the

Format list.

To configure the hx:convertNumber sub tag, right-click the

hx:convertNumber sub tag in the JSP source editor and select

Properties.

File Upload Property <hx:fileProp> Used as a subtag of hx:fileupload to hold properties of the uploaded file. <hx:fileupload> The file upload property subtag is automatically added to your page when you drag <hx:fileupload> to your page.

To configure the sub tag, right-click<hx:fileupload> and select

Properties.

Facet <f:facet> Adds a sub-part to a complex component such as a data table.

  • <h:dataTable>

  • <h:column>

  • <hx:panelMenu>

  • <hx:panelSection>
In the JSP Source editor, type <f:facet /> before the closing parent tag.
*Parameter <f:param> Adds a parameter to a URL emitted by a parent tag.

  • <h:outputLinkEx>

  • <hx:requestLink>
Click

Add Parameter on the

Parameter tab of the parent tag Properties view.

Select Item <f:selectItem> Creates an item in a tag that contains options such as a combo box.

  • <h:selectBooleanCheckbox>

  • <h:selectManyCheckbox>

  • <h:selectOneListbox>

  • <h:selectManyListbox>

  • <h:selectOneRadio>

  • <h:selectOneMenu>

  • <h:selectManyMenu>

  • <hx:selectOneColor>
Click

Add Choice on the patent tag tab in the Properties view.

Select Items <f:selectItems> Creates a set of items in a tag that contains options such as a combo box.

  • <h:selectBooleanCheckbox>

  • <h:selectManyCheckbox>

  • <h:selectOneListbox>

  • <h:selectManyListbox>

  • <h:selectOneRadio>

  • <h:selectOneMenu>

  • <h:selectManyMenu>

  • <hx:selectOneColor>
Click

Add Set of Choices on the parent tag tab in the Properties view.

Validate EL expression <hx:validateConstraint> Validate a value using an EL expression. <h:inputText>

  1. Select

    String from the

    Format list on the parent tag tab of the Properties view.

  2. Click the

    Validation tab.

  3. Click

    Use simple validation then select a constraint from the

    Constraint list.

Validate Date/Time Range <hx:validateDateTimeRange> Validate that a date/time value is greater than and/or less than a bound.

  • <h:inputText>

  • <h:inputMiniCalendar>

  1. Select

    Date/Time from the

    Format list on the parent tag tab of the Properties view.

  2. Click the

    Validation tab.

  3. Click

    Use simple validation then type

    Minimum and/or

    Maximum.

Validate Regular Expression <hx:validateExpression> Validate a value using a regular expression.

  • <h:inputText>

  • <h:inputMiniCalendar>

  1. Click

    Use advanced validation on the

    Validation tab of the parent tag in the Properties view.

  2. Type a validation expression in the

    Advanced validation expression field or click

    Expression Builder to create the validation expression.

Validate Modulus Self Check <hx:validateModulusSelfCheck> Validate a numeric value to see if it passes the Modulus self check algorithm. <h:inputText>

  1. In the JSP Source editor, type <hx:validateModulusSelfCheck /> before the closing parent tag.

  2. To configure the validate modulus self check sub tag, specify which modulus algorithm to use in the validation, in the Properties view.
*Verbatim <f:verbatim> Inserts a verbatim tag that lets you add HTML directly onto a Faces JSP page. Any JSF tag that can contain a JSP tag. Drag the Verbatim component from the palette onto the parent component.

Table 2. Adding custom actions to a JWL JSF component
Custom action Tag Description
Action Listener <f:actionListener> Responds to a specific action event.
Converter <f:converter> Converts an object to a string or a string to an object.
Load Bundle <f:loadBundle> Loads a resource bundle localized for the locale of the current view.
Validate Double Range <f:validateDoubleRange> Checks the value of a component against the specified minimum and maximum values.
Validate Length <f:validateLength> Checks the number of characters in the String representation of the value.
Validate Long Range <f:validateLongRange> Checks the value of a component against the specified minimum and maximum values.
Validator <f:validator> Checks for correctness.
Value Change Listener <f:valueChangeListener> Responds to a change in a specific action.

1 Click the link to see the component properties.