Java Server Faces Çağatay Çivici Apache MyFaces PMC [email_address]
Çağatay Çivici <ul><li>Apache MyFaces PMC(Project Management Committee) member </li></ul><ul><li>Apress’in “The Definitive...
Prime Teknoloji Danışmanlık <ul><li>All about AGILE </li></ul><ul><li>XP (Extreme Programming) </li></ul><ul><li>TDD (Test...
Agenda <ul><li>What is JSF? </li></ul><ul><li>JSF Component Model </li></ul><ul><li>IOC and Managed Beans </li></ul><ul><l...
What is JSF? <ul><li>a component oriented and event driven web framework to build up web applications. </li></ul><ul><li>a...
Architecture
JSF Component Model <ul><li>Covers a wide range components. </li></ul><ul><ul><li>Reusable </li></ul></ul><ul><ul><li>Cust...
Simple Example: HtmlInputText <ul><li>Declared as; </li></ul><ul><ul><li><h:inputText id=“id1” value=“xxx” /> </li></ul></...
JSF Component Tree <ul><li>Components are represented using a tree. </li></ul><ul><li><h:form> </li></ul><ul><li><h:inputT...
IOC and Managed Beans <ul><li><managed-bean> </li></ul><ul><li><managed-bean-name> demo </managed-bean-name> </li></ul><ul...
IOC and Managed Beans <ul><li>JSF uses it’s own container to manage the beans in it’s context. </li></ul><ul><li><managed-...
Scopelar <ul><li>Request  : Request->Response </li></ul><ul><li>Session  : Kullanici sessioni </li></ul><ul><li>Applicatio...
Binding makes JSF powerful <ul><li>Value binding; binds a bean’s variable to a component. </li></ul><ul><ul><li><h:inputTe...
Binding
Events <ul><li><h:commandButton value=“Save” action=“#{createMovie.save}”> </li></ul><ul><li>public class CreateMovie { </...
Events <ul><li><h:commandButton value=“Save” </li></ul><ul><li>action=“#{createMovie.save}” </li></ul><ul><li>actionListen...
JSF Request LifeCycle
Case Study
Conversion and Validation <ul><li>Submitted form values are strings </li></ul><ul><li>Conversion takes place to convert th...
Navigations <ul><li><navigation-rule> </li></ul><ul><li><from-view-id>/login.jsp</from-view-id> </li></ul><ul><li><navigat...
State Management <ul><li>JSF saves and restores the state of the components in each faces request. </li></ul><ul><ul><li>C...
Extending JSF <ul><li>Navigation Handler </li></ul><ul><li>View Handler </li></ul><ul><li>Custom Resolvers </li></ul><ul><...
Multilanguage <ul><li>Support for resource bundles </li></ul><ul><ul><li><application> <locale-config> <default-locale>tr<...
Integration with ... <ul><li>JSF-Spring </li></ul><ul><ul><li>Delegating Variable Resolver </li></ul></ul><ul><ul><li>XML ...
Ajax with JSF <ul><li>Components with ajax support </li></ul><ul><li>JSF ajax frameworks </li></ul><ul><ul><li>JSF Avatar ...
Facelets <ul><li>Replacing jsp markup with xhtml </li></ul><ul><li>Templating </li></ul><ul><li>Composite components </li>...
JSF IDE Support <ul><li>Oracle JDeveloper </li></ul><ul><li>Sun Studio Creator </li></ul><ul><li>JBoss Tools </li></ul><ul...
Introducing Apache MyFaces <ul><li>Open source implementation of JSF </li></ul><ul><li>Trinidad </li></ul><ul><li>Tomahawk...
Future <ul><li>JSF 2.0 </li></ul><ul><li>More powerful IDE support </li></ul><ul><li>More components </li></ul><ul><li>Fac...
The End - Questions? <ul><li>[email_address] </li></ul><ul><li>[email_address] </li></ul><ul><li>www.prime.com.tr/cagatayc...
Upcoming SlideShare
Loading in...5
×

Jsfsunum

1,203

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,203
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Jsfsunum

    1. 1. Java Server Faces Çağatay Çivici Apache MyFaces PMC [email_address]
    2. 2. Çağatay Çivici <ul><li>Apache MyFaces PMC(Project Management Committee) member </li></ul><ul><li>Apress’in “The Definitive Guide to Apache MyFaces and Facelets” co-author </li></ul><ul><li>Referenced “Core JavaServer Faces 2nd Edition” </li></ul><ul><li>Recognized speaker in international seminars such as JSFDays08 </li></ul><ul><li>Oracle RCF(Rich Client Framework) member </li></ul><ul><li>Krank (CRUD Framework for JSF-Spring-JPA) member </li></ul><ul><li>Sourceforge jsf-comp member </li></ul><ul><li>Spring Security(Acegi) JSF Integration author </li></ul><ul><li>JSF Chart Creator project lead </li></ul><ul><li>FacesTrace project lead </li></ul><ul><li>YUI4JSF project lead </li></ul><ul><li>Blog: http://www.prime.com.tr/cagataycivici </li></ul><ul><li>Prime Teknoloji - 2008 </li></ul>
    3. 3. Prime Teknoloji Danışmanlık <ul><li>All about AGILE </li></ul><ul><li>XP (Extreme Programming) </li></ul><ul><li>TDD (Test Driven Programming) </li></ul><ul><li>Testing (Selenium, Mock Objects) </li></ul><ul><li>JSF, Spring, JPA </li></ul><ul><li>Maven, Ant, Continous Integration(Continuum, Cruise Control) </li></ul>
    4. 4. Agenda <ul><li>What is JSF? </li></ul><ul><li>JSF Component Model </li></ul><ul><li>IOC and Managed Beans </li></ul><ul><li>Binding mechanism </li></ul><ul><li>JSF Request Lifecycle </li></ul><ul><li>Navigations </li></ul><ul><li>Internalization and Resource Bundles </li></ul><ul><li>Extending JSF </li></ul><ul><li>Integration with Other Frameworks (Spring Framework Example) </li></ul><ul><li>Ajax with JSF </li></ul><ul><li>Facelets </li></ul><ul><li>Apache MyFaces </li></ul><ul><li>IDE Support </li></ul><ul><li>Future of JSF </li></ul><ul><li>Questions </li></ul>
    5. 5. What is JSF? <ul><li>a component oriented and event driven web framework to build up web applications. </li></ul><ul><li>a Standard – JSR </li></ul><ul><li>Two Implementations </li></ul><ul><ul><li>Sun RI and Apache MyFaces </li></ul></ul><ul><li>Similar concepts </li></ul><ul><ul><li>Asp.net </li></ul></ul><ul><ul><li>Tapestry </li></ul></ul><ul><ul><li>Swing </li></ul></ul>
    6. 6. Architecture
    7. 7. JSF Component Model <ul><li>Covers a wide range components. </li></ul><ul><ul><li>Reusable </li></ul></ul><ul><ul><li>Customizable </li></ul></ul><ul><ul><li>State aware </li></ul></ul><ul><li>Easy to plug in third party components. </li></ul><ul><li>Easy to create custom components of your own. </li></ul><ul><li>Renderers brings abstraction </li></ul>
    8. 8. Simple Example: HtmlInputText <ul><li>Declared as; </li></ul><ul><ul><li><h:inputText id=“id1” value=“xxx” /> </li></ul></ul><ul><li>Gives the output </li></ul><ul><ul><li><input type=“text” id=“parentformid:id1” value=“xxx” /> </li></ul></ul><ul><li>Customization attributes like; </li></ul><ul><ul><li>Styleclass </li></ul></ul><ul><ul><li>Javascript events (onmousover etc...) </li></ul></ul>
    9. 9. JSF Component Tree <ul><li>Components are represented using a tree. </li></ul><ul><li><h:form> </li></ul><ul><li><h:inputText /> </li></ul><ul><li><h:inputText /> </li></ul><ul><li><h:commandButton /> </li></ul><ul><li></h:form> </li></ul>
    10. 10. IOC and Managed Beans <ul><li><managed-bean> </li></ul><ul><li><managed-bean-name> demo </managed-bean-name> </li></ul><ul><li><managed-bean-class> com.prime.tutorial.view.demo </li></ul><ul><li></managed-bean-class> </li></ul><ul><li><managed-bean-scope>request</managed-bean-scope> </li></ul><ul><li></managed-bean> </li></ul>
    11. 11. IOC and Managed Beans <ul><li>JSF uses it’s own container to manage the beans in it’s context. </li></ul><ul><li><managed-bean> </li></ul><ul><li><managed-bean-name>pc_Index</managed-bean-name> </li></ul><ul><li><managed-bean-class>demo.Index</managed-bean-class> </li></ul><ul><li><managed-bean-scope>request</managed-bean-scope> </li></ul><ul><li><managed-property> </li></ul><ul><li><property-name> someVariable </property-name> </li></ul><ul><li><value>#{ pc_DB }</value> </li></ul><ul><li></managed-property> </li></ul><ul><li></managed-bean> </li></ul><ul><li><managed-bean> </li></ul><ul><li><managed-bean-name> pc_DB </managed-bean-name> </li></ul><ul><li><managed-bean-class>demo. Db </managed-bean-class> </li></ul><ul><li><managed-bean-scope> session </managed-bean-scope> </li></ul><ul><li></managed-bean> </li></ul>
    12. 12. Scopelar <ul><li>Request : Request->Response </li></ul><ul><li>Session : Kullanici sessioni </li></ul><ul><li>Application : Uygulama start->stop </li></ul><ul><li>None : JSF sayfalarinda kullanilamaz, istege gore yaratilir, bir yerde tutulmaz </li></ul>
    13. 13. Binding makes JSF powerful <ul><li>Value binding; binds a bean’s variable to a component. </li></ul><ul><ul><li><h:inputText value=“#{person.name}” /> </li></ul></ul><ul><li>Action binding, binds a method to an action component. </li></ul><ul><ul><li><h:commandButton action=“{personSavePage.savePerson}” /> </li></ul></ul>
    14. 14. Binding
    15. 15. Events <ul><li><h:commandButton value=“Save” action=“#{createMovie.save}”> </li></ul><ul><li>public class CreateMovie { </li></ul><ul><li>public String kaydet() { </li></ul><ul><li>... </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
    16. 16. Events <ul><li><h:commandButton value=“Save” </li></ul><ul><li>action=“#{createMovie.save}” </li></ul><ul><li>actionListener=“#{createMovie.saveListener}”> </li></ul><ul><li>public void saveActionListener(ActionEvent e) { </li></ul><ul><ul><li>FacesContext context = FacesContext.getCurrentInstance(); </li></ul></ul><ul><ul><li>String clientId = e.getComponent().getClientId(context); </li></ul></ul><ul><li>} </li></ul>
    17. 17. JSF Request LifeCycle
    18. 18. Case Study
    19. 19. Conversion and Validation <ul><li>Submitted form values are strings </li></ul><ul><li>Conversion takes place to convert these values to java objects </li></ul><ul><li>Validation mechanism validates these converted objects </li></ul><ul><ul><li>Built-in converters and validators </li></ul></ul><ul><ul><li>Easy to write custom converters and validators </li></ul></ul>
    20. 20. Navigations <ul><li><navigation-rule> </li></ul><ul><li><from-view-id>/login.jsp</from-view-id> </li></ul><ul><li><navigation-case> </li></ul><ul><li><from-outcome>success</from-outcome> </li></ul><ul><li><to-view-id>/mainmenu.jsp</to-view-id> </li></ul><ul><li></navigation-case> </li></ul><ul><li><navigation-case> </li></ul><ul><li><from-outcome>failure</from-outcome> </li></ul><ul><li><to-view-id>/login.jsp</to-view-id> </li></ul><ul><li></navigation-case> </li></ul><ul><li></navigation-rule> </li></ul><ul><li>Action specific </li></ul><ul><ul><li><from-action>#{loginBean.loginAction}</from-action> </li></ul></ul><ul><li>Supports patterns </li></ul><ul><ul><li><from-view-id>*</from-view-id> </li></ul></ul>
    21. 21. State Management <ul><li>JSF saves and restores the state of the components in each faces request. </li></ul><ul><ul><li>Client </li></ul></ul><ul><ul><ul><li>As a hidden variable </li></ul></ul></ul><ul><ul><li>Server </li></ul></ul><ul><ul><ul><li>As a session entry </li></ul></ul></ul>
    22. 22. Extending JSF <ul><li>Navigation Handler </li></ul><ul><li>View Handler </li></ul><ul><li>Custom Resolvers </li></ul><ul><li>Phaselisteners </li></ul><ul><li>Custom Components </li></ul>
    23. 23. Multilanguage <ul><li>Support for resource bundles </li></ul><ul><ul><li><application> <locale-config> <default-locale>tr</default-locale> <supported-locale>en</supported-locale> <supported-locale>en_US</supported-locale> <supported-locale>de</supported-locale> </locale-config> <message-bundle> jsfsunum.messages </li></ul></ul><ul><ul><ul><li></message-bundle> </li></ul></ul></ul><ul><ul><ul><li></application> </li></ul></ul></ul><ul><li>jsfsunum/messages.tr </li></ul><ul><ul><li>msg_welcome = Merhaba </li></ul></ul><ul><li>Bundles on faces pages </li></ul><ul><ul><li><f:loadBundle basename=“jsfsunum.labels&quot; var=&quot;msg&quot;/> </li></ul></ul>
    24. 24. Integration with ... <ul><li>JSF-Spring </li></ul><ul><ul><li>Delegating Variable Resolver </li></ul></ul><ul><ul><li>XML Based Approach </li></ul></ul><ul><ul><li>Annotation Based Approach </li></ul></ul><ul><ul><li>Managing JSF Beans with Spring </li></ul></ul><ul><li>EJB3 - Seam </li></ul>
    25. 25. Ajax with JSF <ul><li>Components with ajax support </li></ul><ul><li>JSF ajax frameworks </li></ul><ul><ul><li>JSF Avatar </li></ul></ul><ul><ul><li>Ajax Anywhere </li></ul></ul><ul><ul><li>Ajax4jsf </li></ul></ul><ul><ul><li>IceFaces </li></ul></ul><ul><ul><li>Ajax enabled myFaces components </li></ul></ul>
    26. 26. Facelets <ul><li>Replacing jsp markup with xhtml </li></ul><ul><li>Templating </li></ul><ul><li>Composite components </li></ul><ul><li>Static EL Functions </li></ul><ul><li>Powerful view handler than jsf 1.1 </li></ul><ul><li>No need for tag handlers of jsp </li></ul>
    27. 27. JSF IDE Support <ul><li>Oracle JDeveloper </li></ul><ul><li>Sun Studio Creator </li></ul><ul><li>JBoss Tools </li></ul><ul><li>MyEclipse </li></ul><ul><li>Bea Workshop </li></ul><ul><li>IBM RSA </li></ul>
    28. 28. Introducing Apache MyFaces <ul><li>Open source implementation of JSF </li></ul><ul><li>Trinidad </li></ul><ul><li>Tomahawk </li></ul><ul><li>Orchestra </li></ul><ul><li>Tobago </li></ul>
    29. 29. Future <ul><li>JSF 2.0 </li></ul><ul><li>More powerful IDE support </li></ul><ul><li>More components </li></ul><ul><li>Facelets </li></ul><ul><li>Integrated Ajax Support </li></ul>
    30. 30. The End - Questions? <ul><li>[email_address] </li></ul><ul><li>[email_address] </li></ul><ul><li>www.prime.com.tr/cagataycivici </li></ul>

    ×