##### Struts Faces

- Welcome

##### Components

- Struts Apps
- Struts EL
- Struts Extras
- Struts Faces
- Struts Scripting
- Struts Taglib
- Struts Tiles

##### Quick Links

- Javadoc
- Struts 1

##### Project Documentation

- Project Information
- Project Reports
  - Checkstyle
  - CPD Report
  - JavaDocs
  - PMD Report
  - Source Xref
  - Surefire Report
  - Taglibdoc documentation
  - Tag library validation
  - Tag reference
  - Test JavaDocs
  - Test Source Xref

## Tag reference sheet

Tag library reference for the following tag libraries:

- Struts-Faces (struts-faces.tld) - uri: http://struts.apache.org/tags-faces

## Struts-Faces

This tag library provides custom action functionality that is similar to that provided by the Struts 1.1 tag libraries, but is built on top of the JavaServer Faces rendering architecture.

This tag library includes the following tags:

This is version 1.3.

- base Renders an HTML &lt;base&gt; element with an href attribute pointing to the absolute location of the enclosing JSP page
- commandLink Renders an HTML &lt;a&gt; element defining a hyperlink that submits the current form
- errors Displays a list of error messages prepared by form bean or business logic validation processing
- form Render an HTML form element containing the nested components to present the appropriate label and input field elements
- html Renders an HTML &lt;html&gt; element with language attributes extracted from the user's current Locale object, if there is one
- javascript IMPLEMENTATION NOTE - Unlike other tags in this tag library, this does not correspond to a JavaServer Faces user interface component
- loadMessages Create a Map wrapping the specified MessageResources instance, which will return localized messages based on the Locale stored in the view root component of the current view
- message Render the message text looked up from a message resources bundle, based on our current locale
- stylesheet Renders an HTML &lt;link&gt; element with a relative reference to a text/css stylesheet at the specified context-relative path
- write Render the text associated with the specified model object or text string, optionally performing filtering and formatting tasks described by the optional attributes described below

Required attributes are marked with a *

### <Struts-Faces:base>

Renders an HTML `<base>` element with an `href` attribute pointing to the absolute location of the enclosing JSP page. This tag is valid only when nested inside an HTML `<head>` element. This tag is useful because it allows you to use relative URL references that are based on the URL of the page itself, rather than the URL to which the most recent submit took place.

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
id | Component id of this component. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String
target | Target frame for this base reference. | String

### <Struts-Faces:commandLink>

Renders an HTML `<a>` element defining a hyperlink that submits the current form. This component is required because the JSF 1.0 and 1.1 specifications require interoperability between the renderers for the form element and the command link element, without providing a portable mechanism to allow intermixed libraries.

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
accesskey | null | String
action | null | String
actionListener | null | String
charset | null | String
dir | null | String
hreflang | null | String
id | null | String
immediate | null | String
lang | null | String
onblur | null | String
onclick | null | String
ondblclick | null | String
onfocus | null | String
onkeydown | null | String
onkeypress | null | String
onkeyup | null | String
onmousedown | null | String
onmousemove | null | String
onmouseout | null | String
onmouseover | null | String
onmouseup | null | String
rel | null | String
rendered | null | String
rev | null | String
style | null | String
styleClass | null | String
tabindex | null | String
target | null | String
title | null | String
type | null | String
value | null | String

### <Struts-Faces:errors>

Displays a list of error messages prepared by form bean or business logic validation processing.

In order to use this component successfully, you must have defined an application scope `MessageResources` bean under the specified attribute name, with optinal definitions for the following message keys:

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
bundle | Name of the servlet context attribute under which the desired `MessageResources` bundle is stored. If not specified, the default bundle for this sub-application will be used. | String
id | Component id of this component. | String
property | Component of the component for which to render errors. If not specified, all messages (regardless of property) are displayed. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String

### <Struts-Faces:form>

Render an HTML form element containing the nested components to present the appropriate label and input field elements. This tag is distinguished from the tag in the standard HTML RenderKit because it accepts a Struts `<action>` path as a parameter, and triggers the creation of a Struts form bean if needed.

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
action* | Struts `Action` to which this form should be submitted. This value must exactly match the `path` attribute of the corresponding `<action>` element in the `struts-config.xml` configuration file for this application module. | String
binding | Value binding expression to bind this component to a backing bean property. | String
enctype | The content encoding to be used to submit this form, if the method is `POST`. This must be set to "`multipart/form-data`" if your form includes file upload field(s). If not specified, the browser default ("`application/x-www-form-urlencoded`") is used. | String
focus | The identifier of the form field that should receive focus when this form is rendered. | String
focusIndex | If the focus field is an array, such as a radio button group, you can specify the index of the array element to receive focus. | String
id | Component id of this component. | String
onreset | JavaScript event handler executed if this form is reset. | String
onsubmit | JavaScript event handler executed if this form is submitted. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String
style | CSS styles to be applied to this HTML element. | String
styleClass | CSS style class to use when rendering this component. | String
target | Window target to which this form is submitted, such as for use in framed presentations. | String

### <Struts-Faces:html>

Renders an HTML `<html>` element with language attributes extracted from the user's current Locale object, if there is one.

Can contain: JSP

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
id | Component id of this component. | String
locale | Set to `true` in order to record a `Locale` based on the current request's `Accept-Language` header (if any), if none has currently been set. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String
xhtml | Set to `true` to render an `xml:lang` element on the generated `html` element. It also causes nested Struts HTML tags (although not JavaServer Faces component tags) to render themselves as xhtml. | String

### <Struts-Faces:javascript>

IMPLEMENTATION NOTE - Unlike other tags in this tag library, this does not correspond to a JavaServer Faces user interface component. It is based on the tag implementation class used in the `struts-html` tag library.

Render JavaScript validation based on the validation rules loaded by the `ValidatorPlugIn`. The set of validation rules that should be generated is based on the formName attribute passed in, which should match the name attribute of the form element in the xml file.

The dynamicJavascript and staticJavascript attributes default to true, but if dynamicJavascript is set to `true` and staticJavascript is set to `false` then only the dynamic JavaScript will be rendered. If dynamicJavascript is set to `false` and staticJavascript is set to `true` then only the static JavaScript will be rendered which can then be put in separate JSP page so the browser can cache the static JavaScript.

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
cdata | If set to "true" and XHTML has been enabled, the JavaScript will be wrapped in a CDATA section to prevent XML parsing. The default is "true" to comply with the W3C's recommendation. | String
dynamicJavascript | Whether or not to render the dynamic JavaScript. Defaults to `true`. | String
formName | The key (form name) to retrieve a specific set of validation rules. | String
htmlComment | Whether or not to enclose the javascript with HTML comments. This attribute is ignored in XHTML mode because the script would be deleted by the XML parser. See the cdata attribute for details on hiding scripts from XML parsers. Defaults to `true`. | String
method | The alternate JavaScript method name to be used instead of the of the default. The default is 'validate' concatenated in front of the key (form name) passed in (ex: validateRegistrationForm). | String
page | The current page of a set of validation rules if the page attribute for the field element in the xml file is in use. | String
src | The src attribute's value when defining the html script element. | String
staticJavascript | Whether or not to render the static JavaScript. Defaults to `true`. | String

### <Struts-Faces:loadMessages>

Create a Map wrapping the specified MessageResources instance, which will return localized messages based on the Locale stored in the view root component of the current view.

Can contain: empty

#### Attributes

Name | Description | Type
--- | --- | ---
messages | Application scope key containing the MessageResources instance to be exposed. If not specified, the default MessageResources instance for the current application module is exposed. | String
var* | Request scope key under which the Map will be stored. | String

### <Struts-Faces:message>

Render the message text looked up from a message resources bundle, based on our current locale. The message key must be specified by exactly one of the following attributes:

The `MessageResources` bundle to be used is specified by the `bundle` attribute, as follows:

Substitution parameters for the message may be nested inside this tag by using the `parameter` tag from the standard HTML RenderKit tag library.

Additional control over the rendering process is specified by the following optional attributes, with default values as indicated:

Can contain: JSP

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
bundle | Name of the servlet context attribute under which the desired `MessageResources` bundle is stored. If not specified, the default bundle for this sub-application will be used. | String
filter | Should we filter the output for characters that are sensitive in HTML? The default value is `true`. | String
id | Component identifier of the component corresponding to this tag. | String
key | Literal value of the message key to look up. Exactly one of `key` and `value` must be specified. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String
style | CSS styles used to render this component. | String
styleClass | Name of the CSS style class used to render this component. | String
value | Value reference expression used to retrieve a dynamic value for the message key to look up. Exactly one of `key` and `value` must be specified. | String

### <Struts-Faces:stylesheet>

Renders an HTML `<link>` element with a relative reference to a `text/css` stylesheet at the specified context-relative path.

Can contain:

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
id | Component id of this component. | String
path* | Context-relative path to the resource for this relative link. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String

### <Struts-Faces:write>

Render the text associated with the specified model object or text string, optionally performing filtering and formatting tasks described by the optional attributes described below. The text to be rendered is specified in exactly one of the following attributes:

Additional control over the rendering process is specified by the following optional attributes, with default values as indicated:

Can contain: empty

#### Attributes

Name | Description | Type
--- | --- | ---
binding | Value binding expression to bind this component to a backing bean property. | String
filter | Should we filter the output for characters that are sensitive in HTML? The default value is `true`. | String
id | Component identifier of the component corresponding to this tag. | String
rendered | Boolean attribute indicating whether this component should be rendered or not. | String
style | CSS styles used to render this component. | String
styleClass | Name of the CSS style class used to render this component. | String
value | Literal text to be rendered, or value reference expression to retrieve the text to be rendered. | String