Berner Fachhochschule-Technik und Informatik
Advanced Web Technologies 7) Create a new JSF Components
- Dr. E. Benoist
Fall Semester 09-10
Advanced Web Technologies 7) Create a new JSF Components 1
Writing new Components for JSF
- Motivations
- Write a simple component
Extend a UIComponent Define the renderer Create a custom tag
- A composite Component
Example of JSP file Subclass UIInput Creating a custom tag for FieldComponent The Renderer Mapping a renderer to a component
- Conclusion
Advanced Web Technologies 7) Create a new JSF Components 2
Need a Component?
◮ Use an existing
- Text fields
- Buttons
- Tabbed Pannels
◮ Create your own new Component ◮ Import (or buy) an existing component
- A special calendar for choosing a date
- A field doing special validation client side,
- . . .
Advanced Web Technologies 7) Create a new JSF Components Motivations 3
JSF Component Model
◮ Much like Swing’s component model
- It has events and properties
- also has containers that contain components,
- and that also are components that can be contained by other
containers.
- In theory, the JSF component model is divorced from HTML
and JSP.
- The standard set of components that ships with JSF has JSP
bindings and generates HTML renderings.
◮
Component functionality typically centers around two actions: decoding and encoding data.
- Decoding is the process of converting incoming request
parameters to the values of the component.
- Encoding is converting the current values of the component
into the corresponding markup, that is, HTML.
Advanced Web Technologies 7) Create a new JSF Components Motivations 4