Unformatted text preview:

Java Server FacesThree Main Parts to JSF FrameworkDetailed Features of JSFJSF FundamentalsJSF Life Cycle Overview (From the J2EE Tutorial)PowerPoint PresentationSlide 7Slide 8Slide 9Slide 10Slide 11Development StepsNetBeans JSF Demonstration(0)Netbeans JSF Demonstration(1)Netbeans JSF Demonstration(2)195-733 Internet TechnologiesMaster of Information System ManagementJava Server FacesModel/View/Controller Design Pattern for Web DevelopmentSlides adapted from “Core JavaServer Faces” by Geary and Horstmann,the J2EE Tutorial from Sun Microsystems, and “Developing a VisualWeb JSF Application” from NetBeans.org. 95-733 Internet Technologies295-733 Internet TechnologiesMaster of Information System ManagementThree Main Parts to JSF Framework•A Collection of GUI components for drag and drop web site development•An event driven programming model•A component model supporting third party component development395-733 Internet TechnologiesMaster of Information System ManagementDetailed 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 web495-733 Internet TechnologiesMaster of Information System ManagementJSF 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 cycle595-733 Internet TechnologiesMaster of Information System ManagementJSF Life Cycle Overview (From the J2EE Tutorial)695-733 Internet TechnologiesMaster of Information System ManagementRestore an old or construct a new componentpage (or view)795-733 Internet TechnologiesMaster of Information System ManagementAn old view (component tree) has been retrieved so allow each component in the view to inspect data values. These values willbe redisplayed if validation or conversion errors are found.Adds events to an event queue.895-733 Internet TechnologiesMaster of Information System ManagementThe submitted values are stored as “local values”.If the data is invalid or conversions are not possiblethen Render Response is called directly and the user sees the bad data.995-733 Internet TechnologiesMaster of Information System ManagementLocal valuesare OK andare used to update thebeans.1095-733 Internet TechnologiesMaster of Information System ManagementThe 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.1195-733 Internet TechnologiesMaster of Information System ManagementThe selected page is rendered into a markup language.1295-733 Internet TechnologiesMaster of Information System ManagementDevelopment Steps •Build Model from Java Beans - Lifetime Configured by developer and managed by JSF - Request, Session, or Application Scope - Setters and getters accessed through JSF pages•Use UI Components to build JSF pages - Include JSF Tags, Validation and Event Listeners•Define Page Navigation rules in faces.config.xml1395-733 Internet TechnologiesMaster of Information System ManagementNetBeans JSF Demonstration(0) The example is from: http://testwww.netbeans.org/kb/docs/web/helloweb.html#01Goal: Display a form on the browser. When submitted, the webserver will call our application. The application will execute code in a java bean associated with the page. The bean willupdate page elements. JSF will render the same page withthe changed data and send the page back to the web browser.1495-733 Internet TechnologiesMaster of Information System ManagementNetbeans JSF Demonstration(1)1. File>New Project2. Java Web Application3. Name the project HelloWeb4. Visual Web Java Server Faces5. In properties for page1, enter a page title6. Navigator>Page1>page1 Right Click Add Binding Attribute7. Expand Woodstock Basic section of palette8. Drag a label to page enter “Name:” return9. Drag a text field to page enter “Enter your name” enter10. In properties of text field, change textField1 to nameField11. Right Click text field Add Binding Attribute12. In properties of label component, enter nameField as for property13. Drag a button to the page, type “Say hello” and enter.14. Right click button and choose Add Binding Component.15. In button properties, change id from button1 to helloButton16. Drag static text component to the page.17. In properties static text field, change id to helloText18. Right Click static text and Add Binding AttributeBy adding a bindingattribute we addsetters and gettersto a component.1595-733 Internet TechnologiesMaster of Information System ManagementNetbeans JSF Demonstration(2)19. Drag a Message Group to the page. Good for error reporting.20. Double Click the button component.21. The Java bean for page1 is visible.22. Replace body of helloButton_action with : public String helloButton_action() { String name = (String)nameField.getText(); helloText.setText("Hello, " + name + "!"); return null; }23. Click Run Main


View Full Document

CMU ISM 95733 - Java Server Faces

Download Java Server Faces
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Java Server Faces and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Java Server Faces 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?