Title: Java%20Server%20Faces
1Java Server Faces
- Model/View/Controller Design Pattern for Web
Development
Slides adapted from Core JavaServer Faces by
Geary and Horstmann and the J2EE Tutorial from
Sun Microsystems
2Three main parts to JSF
- A Collection of GUI components
- An event driven programming model
- A component model supporting third party
component development
3Detailed Features of JSF
- Bean management
- Validation model
- Component library that permits extensions
- Flexible rendering (not necessarily XHTML)
- Configurable navigation
- State management
- Conversion Model
- Relies on JSP and Servlet technology
- Think GUI Building for the web
4JSF Fundamentals
- Tags correspond to components in a component tree
- A request normally goes through several stages of
processing on the server - A built-in FacesServlet handles request
processing and the JSF life cycle
5JSF Life Cycle Overview (From the J2EE Tutorial)
6Restore an old or construct a new component page
(or view)
7An old view (component tree) has been retrieved
so allow each component in the view to inspect
data values. These values will be redisplayed if
validation or conversion errors are found.
Adds events to an event queue.
8The submitted values are stored as local
values. If the data is invalid or conversions
are not possible then Render Response is called
directly and the user sees the bad data.
9Local values are OK and are used to update
the beans.
10The action method associated with the button or
link that caused the form to be submitted is
executed. The method returns a string for the
navigation handler. The navigation handler uses
the string to determine the next page.
11The selected page is rendered into a markup
language.
12Some Really Simple Examples
- http//localhost8080/Shopping/
- http//localhost8080/MovieCatalog/
- http//localhost8080/Increment
- http//localhost8080/guessNumber
- http//localhost8080/ACoolJSF