Chapter 7. UI component tags
This chapter covers
- Generating HTML with UI component tags
- Building forms and beyond
- Snazzing it up with templates and themes
- Surveying the components
In the previous chapter, we introduced the Struts 2 tag API. As we saw, this high-level API provides a common set of tag functionality that you can access from any of three view-layer technologies: JSPs, Velocity, and FreeMarker templates. Learn the tag API once, and you’ll start using it everywhere. We saw tags that helped us pull data from the ValueStack, iterate over collections of data, and even control the flow of page rendering with conditional logic of various sorts. Now it’s time to start building a user interface with a special set of tags known as the UI component tags.
UI components take some introduction. Each UI component is a functional unit with which the user can interact and enter data. At the heart of each Struts 2 UI component is an HTML form control, such as a text field or select box. But don’t be mistaken: these components are much more than just tags that output an HTML input element. They are a higher-level component, of which the HTML element is only the browser manifestation. They integrate all areas of the framework, from data transfer and validation to internationalization and look and feel. Some of these components even combine more than one HTML form element to build new functional units for your pages.