1 / 45

JavaServer Faces

JavaServer Faces. Peter Norrhall. Internet - Möjliggöraren. Internet för användare. Internet för utvecklare. Det suger!!!. €. €. €. €. €. €. €. €. €. €. €. €. Bra för konsulter. Dåligt på lång sikt. Java. GUI. Data. Business. JavaServer Faces. EJB 3. JPA. GWT.

Download Presentation

JavaServer Faces

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JavaServer Faces Peter Norrhall

  2. Internet - Möjliggöraren JavaServer Faces

  3. Internet för användare JavaServer Faces

  4. Internet för utvecklare Det suger!!! JavaServer Faces

  5. € € € € € € € € € € € Bra för konsulter JavaServer Faces

  6. Dåligt på lång sikt JavaServer Faces

  7. Java GUI Data Business JavaServer Faces EJB 3 JPA GWT JavaServer Faces

  8. JavaServer Faces JavaServer Faces

  9. Managed Beans SearchBean { ... private String searchInput public String search() { ... } } Managed Beans Action JavaServer Faces

  10. Managed Beans SearchBean { ... String searchInput String search() { ... return ”result”; } } Navigering JavaServer Faces

  11. Navigering JavaServer Faces

  12. Demo JavaServer Faces

  13. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values UI Component Tree HtmlInputText HtmlMessage HtmlCommandButton HtmlForm UIViewRoot Restore View JavaServer Faces

  14. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values UI Component Tree HtmlInputText HtmlMessage HtmlCommandButton HtmlForm UIViewRoot Apply Request Values Multi* JavaServer Faces

  15. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values UI Component Tree Managed Beans SearchBean { ... String searchInput String search() { ... } } HtmlInputText HtmlMessage HtmlCommandButton HtmlForm UIViewRoot Process Validations <h:inputText id="email" value="#{UserRegistration.user.email}" validator="#{UserRegistration.validateEmail}" required="true"> </h:inputText> Multi* JavaServer Faces

  16. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values UI Component Tree Managed Beans SearchBean { ... String searchInput String search() { ... } } HtmlInputText HtmlMessage HtmlCommandButton HtmlForm UIViewRoot Update Model Values Multi* JavaServer Faces

  17. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values Invoke Application UI Component Tree Managed Beans Multi* SearchBean { ... List result String searchInput String search() { ... } } HtmlInputText HtmlMessage HtmlCommandButton HtmlForm UIViewRoot JavaServer Faces

  18. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values UI Component Tree HtmlInputText HtmlInputText HtmlInputText UIColumn UIColumn UIColumn HtmlDataTable UIViewRoot Render Response Managed Beans SearchBean { ... List result String searchInput String search() { ... } } JavaServer Faces

  19. Nyheterna i JSF 1.2 < Jsp 2.1 < Jsf 1.2 JavaServer Faces

  20. Unified EL • #{searchBean.inputString} - deferred • ${searchBean.inputString} – immediate • Implicita objekt (application, cookie, ...) • Operatorer (+.-,*,/,%,A?B:C,==,!=,...) • Uttryck (#{searchBean.search}) JavaServer Faces

  21. Nyheter i Jsf 1.2 - Sammanfattning • http://java.sun.com/developer/technicalArticles/J2EE/jsf_12 JavaServer Faces

  22. Verktyg NetBeans Exadel Studio Oracle JDeveloper JBuilder Java Studio Creator SAP Developer Studio IntelliJ IDEA BEA Workshop Websphere Studio JavaServer Faces

  23. Komponentbibliotek • JSF • MyFaces Extensions • Apache Tobago/ADF Faces (Oracle) • ICEFaces • Netadvantage for JSF • BackBase • RichFaces (Ajax4JSF) JavaServer Faces

  24. Förändra/skapa komponenter JavaServer Faces

  25. RestoreView Apply Request Values Process Events Process Validations Process Events Render Response Process Events Invoke Application Process Events Update Model Values Förändra komponenter • Egenskaper • CSS <h:inputText id="email" value="#{UserRegistration.user.email}" validator="#{UserRegistration.validateEmail}" required="true"> </h:inputText> JavaServer Faces

  26. Skapa en komponent JavaServer Faces

  27. JSF och Ajax • Komponentbibliotek • Sun Blueprint AJAX components • Ajax4JSF • Seam Remoting JavaServer Faces

  28. Ajax4Jsf – a4j:support JavaServer Faces

  29. Ajax4Jsf – CommandButton <a4j:commandButton action="#{searchBean.handleSearch}” reRender=”tblSearchResult, txtSearchTerm” value="#{bundle['search.search']}" styleClass="html-text"/> JavaServer Faces

  30. Ajax4Jsf • <a4j:commandLink> • <a4j:region> • <a4j:poll> • <a4j:outputPanel> JavaServer Faces

  31. JSF Ramverk • Apache Shale vs JBoss Seam • Dialog Manager (Conversation) • Validation • Remoting (Ajax) • Clay (Non-Jsp) • ... JavaServer Faces

  32. EJB 3 Managed Beans @Stateless @Name(”searchBean”) public class SearchBean implements Search{ @Out List <SearchResult> result; @In @Out String searchInput String search() { ... } } SearchBean { ... List result String searchInput String search() { ... } } JBoss Seam <h:commandButton action="#{searchBean.search}" value="#{bundle['search.search']}" styleClass="html-text"/> JavaServer Faces

  33. @Annoteringar - Validering public class UserRegistrationBean { @NotNull @Email public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } } JavaServer Faces

  34. Seam – Ajax Remoting @Local public interface Search { @WebRemote public String suggest(String name); } @Name(”search”) public class SearchAction implements Search { public String suggest(String name) { String suggestion = null; ... return suggestion; } } <script language=”javascript”> // get the remote Search var search = Seam.Component.getInstance(”search”); function suggest(name) { search.suggest(name, suggestCallback); } function suggestCallback(suggestion) { form.suggestion.value = suggestion; } </script> JavaServer Faces

  35. JBoss Seam • Fogar samman JSF och EJB 3 (Web Beans) • @Annoteringar – Ut med XML-konfig • AJAX för en bättre värld • Conversation – Stöd för tillståndsfulla multipla ”konversationer” JavaServer Faces

  36. Facelets JavaServer Faces

  37. Facelets - Våga Vägra JSP! JavaServer Faces

  38. Facelets - Mallbaserat template.css template.xhtml .top{ margin: 0px; padding: 0px; height: 58px; width: 770px; font: 20px Verdana, Tahoma, Arial text-decoration-none } .right { ... } .bottom { ... } .container { ... } top container right bottom JavaServer Faces

  39. Produktkatalog <ui:composition template="/templates/catalog_template.xhtml"> category.xhtml catalog_template.xhtml Menu (top) <ui:insert name=”container”> container </ui:insert Branding (right) <ui:define name=”container"> ... <h:graphicImage value=”...”/> ... </ui:define> <ui:define name=”container"> ... <h:graphicImage value=”...”/> ... </ui:define> ShoppingCart/CompanyInfo (bottom) product.xhtml JavaServer Faces

  40. Produktkatalog catalog_template.xhtml product.xhtml JavaServer Faces

  41. Facelets – enklare att • Skapa egna komponenter • Skapa valideringsfunktioner • Skapa ”taggar” • Skicka parametrar mellan sidor • Exadel Studio JavaServer Faces

  42. Prestanda JavaServer Faces

  43. Cache is King <s:cache key=”art_93682” enabled=”true” <h:outputText value=”#{art.title}”/> <h:outputText value=”#{art.header}”/><h:outputText value=”#{art.body}”/> </s:cache> JavaServer Faces

  44. JSF 2.0 • Web Beans JSR 299 - JBoss • Oracles JSR för att uttöka designtime stödet i GUIbyggare • http://www.jsfcentral.com/listings/A10880?link JavaServer Faces

  45. Summering JavaServer Faces

More Related