• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,078
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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