JSF
Jump to navigation
Jump to search
Brings swing like programming to the web:
- set of UI components
- event driven
- component model (ability to extend)
- buttons, tables, input, tree handling
- Beans are used to communicate between the interface and application
- JSF pages can be .jsp or .jsf the url convention is .faces (with mapping) (jsf require more configuration)
- Can use normal jsp or XML version
- Note handles (legitimate) beans that don't have both getters and setters
Can call methods, set parameters:
<jhtml:inputText value="#{user.name}"/> <jhtml:commandButton value="Submit" action="#{foo.doStuff}"/>
Has support for:
- Validation
- Data conversion
- Internationalisation
- Custom components
- Different clients e.g. wml
Processing
- "Restore View" - retrieves new values, creates component tree for processing (component for each bean/action class)
- "Apply Request Values" - each bean component processes it's values
- "Process Events" - adds action to list for each event button/link
- "Process Validations" - type conversion etc
- skips to "Render Response" on error for data re-entry - redisplays data entry page - need to display error to indicate why
- "Update Model Values" - applies the new values to the beans
- "Invoke Application" - invokes the list of actions
- result is a string passed to the navigation handler - used to look up next page
- "Render Response"
Beans
- backing beans - beans tying behaviour to interface form
- public no arg constructor
Notation:
- ${..} immediate evaluation - on processing the page - typically JSP/JSLT
- #{..} deferred evaluation - evaluated whenever needed - typically JSF