This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Form Tags

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.

...

The xhtml theme renders out a two-column table. If a different layout is needed, do not write your own HTML. Create a new theme or utilize the simple theme.

...

Template-Related Attributes

Wiki Markup
{snippet:id=templateRelatedAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}

...

Javascript-Related Attributes

Wiki Markup
{snippet:id=javascriptRelatedAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}

...

Tooltip Related Attributes

Wiki Markup
{snippet:id=tooltipattributes|javadoc=true|url=org.apache.struts2.components.UIBean}

...

General Attributes

Wiki Markup
{snippet:id=generalAttributes|javadoc=true|url=org.apache.struts2.components.UIBean}

...

Some tag attributes may not be utilized by all, or any, of the templates. For example, the form tag supports the tabindex attribute, but none of the themes render the tabindex.

Value/Name Relationship

In many of the tags (except for the form tag) there is a unique relationship between the name and value attributes. The name attribute provides the name for the tag, which in turn is used as the control attribute when the form is submitted. The value submitted is bound to the name. In most cases, the name maps to a simple JavaBean property, such as "postalCode". On a submit, the value would be set to the property by calling the setPostalCode mutator.

Likewise, a form control could be populated by calling a JavaBean accessor, like getPostalCode. In the expression language, we can refer to the JavaBean property by name. An expression like "%{postalCode}" would in turn call getPostalCode.

...

...

<@s.form action="updateAddress">
    <@s.textfield label="Postal Code" name="postalCode" value="%{postalCode}"/>
    ...
</@s.form>

However, since the tags imply a relationship between the name and value, the value attribute is optional. If a value is not specified, by default, the JavaBean accessor is used instead.

...

...

<@s.form action="updateAddress">
    <@s.textfield label="Postal Code" name="postalCode"/>
    ...
</@s.form>

While most attributes are exposed to the underlying templates as the same key as the attribute (${parameters.label}), the value attribute is not. Instead, it can be accessed via the nameValue key (${parameters.nameValue}). The nameValue key indicates that the value may have been generated from the name attribute rather than explicitly defined in the value attribute.

...

The required attribute on many UI tags defaults to true only if you have client-side validation enabled, and a validator is associated with that particular field.

Tooltip

Wiki Markup
{snippet:id=tooltipdescription|javadoc=true|url=org.apache.struts2.components.UIBean}
Wiki Markup
{snippet:id=tooltipexample|lang=xml|javadoc=true|url=org.apache.struts2.components.UIBean}

...

Next: UI Tag Reference