...
The types of tags can be broken in to two types: general generic and HTMLUI. Besides function and responsibility, the biggest difference between the two is that the HTML tags support templates and themes. In addition to the general tag reference, we also provide examples for using these generic tags in each of the support languages.
Be sure to read the Tag Syntax document and understand to learn how tag attribute syntax works.
General Tags
General tags are used for controlling the execution flow when the pages render. These tags also allow for data extraction from places other than your action or the value stack, such as Internationalization, JavaBeans, and including additional URLs or action executions.
- Control Tags provide control flow, such as if, else, and iterator.
- Data Tags allow for data manipulation or creation, such as bean, push, and i18n.
HTML Tags
Unlike general tags, HTML tags do not provide much control structure or logic. Rather, they are focussed on using data, either from your action/value stack or from the Data Tags, and displaying data in rich and reusable HTML. All HTML tags are driven by templates and themes. While general tags simply output some content directly from the tag (if there is any content to output), the HTML tags defer to a template, often grouped together as a theme, to do the actual rendering.
Template support allows HTML tags to build a rich set of reusable UI components that can be customized to fit exact requirements. For details, see Themes and Templates.
A must-read explanation of how themes and templates are uses when rendering HTML tags. | |
provide all form-related HTML output, such as form, textfield, and select. | |
provide all non-form-related HTML output, such as a, div, and tabbedPanel. |
Language Specific Tag Support
The framework strives to support multiple development environments. The framework does not impose a single template language. Almost any common language can be used, and there are hooks for new languages. By default, almost every single tag is supported in JSP, Velocity, and FreeMarker. In each of these sections, you'll find examples and techniques for applying the generic tag reference toward your specific language or template choice.
...
FAQs
- Why do the form tags put table tags around controls?
- How can I put a String literal in a Javascript call, for instance in an onChange attribute?
- Why won't the 'if' tag evaluate a one char string?
- Why does FreeMarker complain that there's an error in my user-directive when I used JSP Tag?
- Can an action tag run another method apart from the default execute method?
- Why didn't my action tag get executed when I have validation errors?
- Why are request parameters appended to our hyperlinks?
Resources
- Creating a UI Component in Struts 2 (Mark Menard)
- Struts 2 Tags (Rose India)
Next: Generic
...