SlideShare ist ein Scribd-Unternehmen logo
1 von 62
JavaServer Pages™ /Servlets
 and Web Application Frameworks

Doris Chen, Ph.D
Staff Engineer          This box provides
                        space for call to

Sun Microsystems, Inc   action text, URLs,
                        or any relevant info
Speaker’s Qualifications
●   Doris Chen
    –   Technology Evangelist at Sun Microsystems
    –   Develops and delivers Code Camps for
        J2EE, Java performance tuning, J2ME and web
        services technologies for Sun Microsystems
    –   Speaks around the world concerning
        Sun™ technologies
Presentation Agenda
●   JSP™/Servlets Overview
●   Frameworks
    •   Struts
    •   JavaServer™ Faces
    •   Sun™ ONE Application Framework (JATO)
●   Summary and Resources
How It Fits Together

       JSF                                      S1AF
                          JSTL
       Struts
                             JSP™
                java bean, expression
                lang.,custom tag lib

                         Servlet
        session tracking, filtering, listener
Web Foundation: JSP™/Servlets

●   Java Servlet technology since ’96, JSP 1.0
    specification in June ’99
●   Servlets and JSP technologies:
    •   JSP 1.2 and Java Servlet 2.3 technologies in the J2EE
        1.3 platform (now)
    •   JSP 2.0 and Java Servlet 2.4 technologies in the J2EE
        1.4 platform (proposed final draft)
Java Servlet Technology
●   Foundation for many technologies
    •   The JAX-RPC API
    •   Java portlet technology
    •   The JAXM API
    •   Struts, JavaServer Faces™, Sun™ ONE application
        framework
●   Well understood by industry
The JavaServer Pages™
    (JSP™) Specification
●   JavaServer Pages technology: Building
    Block
●   Mature spec
●   Widely Used
●   Many uses of Tag Libraries
●   Very good community, look for the
    JSP 2.0 release
JSP Architecture
                             Servlet Engine
 Client Request                 JSP
                             Translator


                  Redirect     JSP                 Create
Response          Load JSP   Servlet               Servlet


                                                 Load Servlet


                             JSP       Servlet
Frameworks                     Struts

Sun™ ONE Application
Framework              JS L
                         T         SA
                                    1F
                                    WAF

                           JavaServer Faces™
                                (events) Server
                       Client Request      UI


                               Response
                                 (markup)
Presentation Agenda
●   JSP™/Servlets Overview
●   Frameworks
    •   Struts
    •   JavaServer™ Faces
    •   Sun™ ONE Application Framework (JATO)
●   Summary and Resources
Jakarta Struts
●   Struts is an open source framework developed
    by the Apache Jakarta project
    http://jakarta.apache.org/struts/
     –   Struts 1.02 is available and Struts 1.1 is in beta
●   Struts allows:
     –   JSP/Servlet developers to fashion their web applications
         using the MVC design pattern
     –   Configure a lot of the default framework objects through
         xml configuration files
     –   Run Servlet2.2/JSP1.1 container and above
Model-View-Control (model 2)
                                                        MVC Design Pattern

              1
            Request
                           (Controller)
                           Servlet
  BROWSER




                                     In
                       Redirect 3


                                       st
                                                 2


                                         an
                                           tia
                                           te
              5           (View)                 (Model)
                                                 Java Bean
            Response      JSP             4



                           Servlet Container                     (EIS)
Struts: MVC Pattern Implemented

                                 Controller
                                                                   Model
                       Action          Action
                                       Mapping            Action
                       Servlet
           Request                      (xml)


 Client

                                                            uses
          Response

                                      Action     Action
                     JSP View
                                     Forward     Form          Model Data
  View
Struts Components and
    Feature
●   The View - a JSP or HTML page
●   The Model - a Java object ( called a
    ActionForm)
●   Central controller – ActionServlet
    •   URI to ActionMapping(Action class) located in struts-
        config.xml file
    •   Action classes
          • Adaptors between business layer and web tier


●   Validation, Internationalization, Custom
    tags for creating HTML, presentation logic,
    and templating
Model
●   Model classes should be coded independent
    of the Struts framework
    –       Maximum code reusability by other applications
●   Struts provides default Model components,
    most important one ActionForm
        •   Create model class by extending the Struts
            ActionForm class
●   Struts provides a org.apache.struts.util.PropertyUtils
    has a static method called copyProperties()
    –       To copy all form properties to your original model
            object when your controller receives a form
Controller
●   The controller is the switch board of MVC
●   Directs the user to the appropriate views by
    providing the view with the correct model
●   The task of directing users to appropriate views
    is called “mapping”
●   Struts framework provides a base object called
    org.apache.struts.action.ActionServlet
Controller (Cont.)
Http://myhost/authorize.do


Server configured to pass *.do extensions to
org.apache.struts.action.ActionServlet via a web.xml configuration file


ActionServlet object inspects the URI and tries to match it
against an ActionMapping located in the struts-config.xml file

Instance of appropriate Action class is found and it’s perform() is called


Action object handles the request and returns control to a view
based where the user is within the flow of the application
struts-config.xml: ActionMapping
<action-mappings>
       <action     path="/logon"
              type="org.apache.struts.example.LogonAction"
              name="logonForm"
              scope="request"
              input="/logon.jsp">
       </action>
       <forward    name="success” path="/msgBoard.jsp"/>
</action-mappings>
View
●   ActionForward object tells JSP page to dispatch
    to
●   The view in Struts is represented by JSP
●   JSP can use ActionForm bean to get output
    Model data to display
●   Struts contains a series of tag libraries
    –   Facilitates communication between HTML designers
        and developers
    –   Facilitates dynamic Web content
View: Example
1    <%@ page language="java" %>
2    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
3    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
4    <html:html locale="true">
5    <head>
6    <title><bean:message key="logon.title"/></title>
7    <html:base/>
8    </head> ...
9    <html:errors/>
10    ...
11    <html:form action="/logon.do" focus="username">
12    <table border="0" width="100%"> ...
13    <html:submit property="submit" value="Submit"/>
14     ...
15    </html:form>
16    ...
17    </html:html>
Struts Example
        Page 1                      Jsp 1        Jsp 2      Jsp 3


                 Web Browser


Web Server
                                                                                       Form      Request/session   View
                                            Jsp Engine                                 Bean      Form
                                                                                         1       Bean    Other
                                                                                                                   Layer
                                                                                                   2     Bean
                                                                                                           1


                          Controller
    Struts-
    config.
     xml
                     Mappings

                 •    path                  Action1           Action2               Action3             Action4
                 •    action                 .java             .java                 .java               .java
                 •    [form bean]
                 •    [forwards]
                                                                                                                   Business
                                                 Business                Business                 Business
                                                  Bean 1                  Bean 2                   Bean 3           Logic
                                                                                                                    Layer
                                    CoreSession             CoreSession                       Socket
                                                                                                                   Data
                                                                    MarkVision Server                              Layer
Presentation Agenda
●   JSP™/Servlets Overview
●   Frameworks
    •   Struts
    •   JavaServer™ Faces
    •   Sun™ ONE Application Framework (JATO)
●   Summary and Resources
JavaServer Faces Design Goals
●   Tool Friendly
●   Client device neutral
●   Usable with JavaServer Pages (JSP)
●   Usable without JSP
●   Useful in today's lowest common
    denominator browsers
●   Scalable
JavaServer Faces Requirements
●   Extensible UI component model
●   Flexible rendering model
●   Comprehensive event model
●   Powerful Validation framework
●   Flexible error handling
●   Basic page navigation
●   Internationalization and Accessibility
How the JSF Specification Fits
In
         JSF App
                        JSF App
        JSF Tags

       JSP (1.2)       JSF API

            Servlets (2.3)
JSF Architecture
                        Server

             Request     UI
   Client    (Events)


            Response


            (Markup)
JSF Architecture
                           Server
                           JSF Page
             HTML
   Desktop
                                 HM
                                  TL
   Browser                     R d it
                                en erK


                   Front                   App
                   ctrl      JSF Page    Backend


                                 WL
                                  M
                               R d it
                                en erK
   Phone
             WML
JSF Specification: Customers
        Application            Extensions


                                     Tools
      Page                         Developer
     Author
                  Component
                   Developer           JSF
    Application                   Implementor/
     Developer                      Extender
Key JSF Concepts
●   UIComponent – JavaBean like classes
    ─ Render-independent characteristics
    ─ Base class with standard behaviors
●   Standard UIComponent Subclasses:
    ─ UICommand, UIForm, UIGraphic, UIInput, UIOutput, UIPanel,
      UISelectBoolean, UISelectMany, UISelectOne
●   FacesEvent – Base class for request and
    application events
●   Validator – Base class for standard and
    application defined validators
Key JSF Concepts
●   Converter – Plug-in for String-Object
    conversion
●   FacesContext – Per-Request State:
    ─ Servlet request, response, session
    ─ JSF request, response trees
    ─ Model reference expression evaluators
       • Syntax similar to the expression language of the JSP
         Standard Tag Library (JSTL) 1.0
       • Primary interface between components and the data
         provided by (or to) the application
Key JSF Concepts

●   Renderer – Converts components to and
    from a specific markup language
    ─ Supports render-dependent attributes on
      components
    ─ May support more than one component type
●   RenderKit – Library of Renderers
    ─ Extensible at runtime
    ─ Basic HTML RenderKit is part of the specification
JSF Example
1    <%@ page language="java" %>
2    <%@ taglib uri="http:://java.sun.com/j2ee/html_basic" prefix="faces" %>
3
4    <jsp:usebean id="UserNumberBean” class=”NumberBean” scope=session>
5    <faces:usefaces>
6     <faces:form id="helloForm" forname="helloForm">
7     <faces:textentry_input id="username" modelReference
8     ="UserNameBean.userName">
9
10     <faces:command_button id="submitButton" label="submit">
11    </faces:form>
12    </faces:usefaces>
13    ...
14    </html:html>
Component Tree


                        HelloForm




 Input                                             Form
 text        UserName               Submit         event
    Stored                                   Queued
Steps in Development Process
●   Author the pages using the UI component
    tags
    •   useBean tag
    •   faces tags:
         •   faces:form, faces:textentry_input, faces:command_button
●   Develop the model objects, which will hold
    the data
●   Develop navigation handlers
    •   Define the navigation for the application by
        implementing ApplicationHandler class
Current Development Status
●   Warning – everything above is subject to
    change!
●   Under development in JSR-127
    ─ Introduced at JavaOne US 2001
●   Large expert group
    ─ Framework developers, Tools providers, ISVs
●   Completed Community Draft status (07/2002)
●   Working towards Public Draft release of
    specification
Current Development Status
●   Early Access of Reference Implementation
    is also available
●   Early Access (pre-Public Draft) Specification
    available:
    •   http://java.sun.com/j2ee/javaserverfaces/
●   JSF Public Forum:
    •   http://forum.java.sun.com/forum.jsp?forum=427
●   JSF Comments: jsr-127-
    comments@sun.com
●   Intranet Site:
    http://wspack.sfbay.sun.com/jsf
If You Only Remember One
Thing…
●   JavaServer Faces is destined to become the
    standard mechanism for creating user
    interface components for J2EE based web
    applications.
Presentation Agenda
●   JSP™/Servlets Overview
●   Frameworks
    •   Struts
    •   Sun™ ONE Application Framework (JATO)
    •   JavaServer™ Faces
●   Summary and Resources
Sun™ ONE Application
Framework (JATO) Overview
●   A J2EE application framework
    •   Primarily focused on web tier
    •   Leverage Sun Java Center J2EE Patterns
●   Provide a robust, scalable application
    foundation
    •   Application composition via reusable components
    •   Full-featured event model and high-level tag library
●   SOAP & Web Services support / integration
●   Leveraged through Sun ONE Studio Wizard-
    based visual interfaces
Where can the Sun ONE
Application Framework be used?
●   Enterprises or ISV's building large
    enterprise web applications
●   Large development team (10+) focused on
    web applications
●   Few really know Java APIs at the web tier
    or enterprise tier
Sun ONE Application Framework
(JATO) Platform Stack
S1AF and Your Application
J2EE Design Pattern
●   Leverage Sun Java Center J2EE Patterns
    •   Best practice design patterns for J2EE
        development
    •   Fine grained patterns
         •   Can be combined into a complete MVC

●   Use Model View Controller pattern
    (MVC)
J2EE patterns used in S1AF

●   Business delegate
●   View helper
●   Composite view
●   Service to worker
●   Front controller
Sun ONE Application Framework
Models
 ●   Implements Business Delegate pattern
     –   Reduce coupling between presentation tier clients and business
         services
     –   Hides the underlying implementation details of business service
         (e.g. JDBC details)
 ●   Provides developers a common interface for using any
     Enterprise resource
     –   Web Service resources
     –   Database resources
     –   UIF (Enterprise Connectors) resources
     –   J2EE Connector Architecture resources
     –   AND 3rd party created
Views
●   A union of JSP tags with S1AF view objects
    –   S1AF JSPs use S1AF tags and othe 3rd party tags
    –   S1AF views simply refer to model data
●   Implements J2EE view helper pattern
    –   S1AF views allows JSPs to remain Java-free
    –   Presentation logic is placed in View class
    –   More than one JSP can use a View Helper
        •   Allows for variable content rendering

●   Implements J2EE Composite View Pattern
    –   S1AF view may be arbitrarily nested
JSP/View/Model Relationships
Controller
●   Consistes of two patterns
    –   Front controller
    –   Service to workers
●   Implements front controller pattern
    –   All requests pass through front controller
    –   Module servlet serves as front controller
    –   Single point of entry allows for centralization
        of certain types of logic
Controller (Cont.)

●   Implements ServiceToWorker pattern
    –   Single service dispatches to request specific
        controllers(workers)
        •   All requests pass through the FrontController
        •   Controller logic can be partitioned into more fine
            grained units for scalability and logical partitioning
    –   S1AF module servlet dispatches request to
        the appropriate worker (controller)
        •   S1AF controller can be a Command interface
        •   Developers will implement the command interface
Tool & Wizard Friendly
View Components
●   “ Out of the box” Page components are available such
    as Button, Check Box, Combo Box
●   3rd party (SI’s) components can be dynamically added
    to the product
Component Story
Component Story
Component Story
Component Story
Component Story
Presentation Agenda
●   JSP™/Servlets Overview
●   Frameworks
    •   Struts
    •   JavaServer™ Faces
    •   Sun™ ONE Application Framework (JATO)
●   Summary and Resources
JSF, Struts and S1AF
●   Focus is a bit different
    –   Struts: encapsulates user-interface more at form or page level
    –   JSF: UI components, component model for user-interface, Tools
        focus
    –   S1AF: extends MVC and J2EE design pattern and comes with an
        extendable but ready-to use base implementation, visual builder
        tool
●   Some overlap
    –   Use the parts that are helpful, ignore the parts that are not
    –   Pick solution best suited to expertise/task
    –   JSF/Struts integration
    http://jakarta.apache.org/builds/jakarta-struts/nightly/struts-
      faces/
JSF, S1AF, and Struts
●   All three communities are represented on
    JSR-127 expert group
    –   The lead developer of Struts, Craig McClanahan, now
        works for Sun and is a member of JSF expert group
    –   S1AF Architect is already participating in expert group
        meeting
    –   Long term strategy:
         ●   S1AF and struts will co-exists/merge with S1af evolving to
             use struts controller technology and JSF components
         ●   Goal is to provide a single web-based framework also
             monetizes struts technology
Where to look further
●   JSF
    http://java.sun.com/products/j2ee/javaserverfa
●   Struts http://jakarta.apache.org/struts
●   A good place to start is the S1AF-Tips group:
    http://groups.yahoo.com/group/iPlanet-JATO-
    Tips/
●   FAQ of the larger community forum at:
    http://groups.yahoo.com/group/iPlanet -JATO/
●   The Whitepaper: http://ias.red.iPlanet.com/jato
●   You can get more information at:
    http://developer.iPlanet.com/tech/appserver/fr
    amework/index.jsp
JavaServer Pages™ /Servlets
and Web Application Frameworks

Doris Chen, Ph.D
doris.chen@sun.com

Weitere ähnliche Inhalte

Was ist angesagt?

Java server faces
Java server facesJava server faces
Java server facesowli93
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applicationselliando dias
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Courseguest764934
 
Sun JSF Presentation
Sun JSF PresentationSun JSF Presentation
Sun JSF PresentationGaurav Dighe
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage componentsBenoit Marchant
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component BehaviorsAndy Schwartz
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the clientSebastiano Armeli
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworksukdpe
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJosh Juneau
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkGuo Albert
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsBG Java EE Course
 
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6Lokesh Singrol
 

Was ist angesagt? (20)

Struts course material
Struts course materialStruts course material
Struts course material
 
Java server faces
Java server facesJava server faces
Java server faces
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
Jsf intro
Jsf introJsf intro
Jsf intro
 
Struts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web ApplicationsStruts An Open-source Architecture for Web Applications
Struts An Open-source Architecture for Web Applications
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
Struts Introduction Course
Struts Introduction CourseStruts Introduction Course
Struts Introduction Course
 
Sun JSF Presentation
Sun JSF PresentationSun JSF Presentation
Sun JSF Presentation
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
 
Jsf2.0 -4
Jsf2.0 -4Jsf2.0 -4
Jsf2.0 -4
 
Modular applications with montage components
Modular applications with montage componentsModular applications with montage components
Modular applications with montage components
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns FrameworksMike Taulty MIX10 Silverlight 4 Patterns Frameworks
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
 
Jsf
JsfJsf
Jsf
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVC
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6TY.BSc.IT Java QB U5&6
TY.BSc.IT Java QB U5&6
 

Andere mochten auch

Spring mvc
Spring mvcSpring mvc
Spring mvcBa Big
 
ETOM Enterprise Framework Management
ETOM Enterprise Framework ManagementETOM Enterprise Framework Management
ETOM Enterprise Framework ManagementInfosys
 
Luận văn tìm hiểu Spring
Luận văn tìm hiểu SpringLuận văn tìm hiểu Spring
Luận văn tìm hiểu SpringAn Nguyen
 
E tom awareness session for quick overview and deployment
E tom awareness session for quick overview and deploymentE tom awareness session for quick overview and deployment
E tom awareness session for quick overview and deploymentPraveen Kumar Kambhampati
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMAashish Jain
 
eTOM and ITIL engagements
eTOM and ITIL engagementseTOM and ITIL engagements
eTOM and ITIL engagementsAhmed Selim
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)Fahad Golra
 
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...Alan McSweeney
 
Telecommunication Business Process - eTOM Flows
Telecommunication Business Process - eTOM FlowsTelecommunication Business Process - eTOM Flows
Telecommunication Business Process - eTOM FlowsRobert Bratulic
 

Andere mochten auch (10)

Spring mvc
Spring mvcSpring mvc
Spring mvc
 
ETOM Enterprise Framework Management
ETOM Enterprise Framework ManagementETOM Enterprise Framework Management
ETOM Enterprise Framework Management
 
Luận văn tìm hiểu Spring
Luận văn tìm hiểu SpringLuận văn tìm hiểu Spring
Luận văn tìm hiểu Spring
 
E tom awareness session for quick overview and deployment
E tom awareness session for quick overview and deploymentE tom awareness session for quick overview and deployment
E tom awareness session for quick overview and deployment
 
eTOM - Foundation
eTOM - FoundationeTOM - Foundation
eTOM - Foundation
 
ASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOMASP, ASP.NET, JSP, COM/DCOM
ASP, ASP.NET, JSP, COM/DCOM
 
eTOM and ITIL engagements
eTOM and ITIL engagementseTOM and ITIL engagements
eTOM and ITIL engagements
 
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)Lecture 4:  JavaServer Pages (JSP) & Expression Language (EL)
Lecture 4: JavaServer Pages (JSP) & Expression Language (EL)
 
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...
Applying eTOM (enhanced Telecom Operations Map) Framework to Non-Telecommunic...
 
Telecommunication Business Process - eTOM Flows
Telecommunication Business Process - eTOM FlowsTelecommunication Business Process - eTOM Flows
Telecommunication Business Process - eTOM Flows
 

Ähnlich wie Jsf Framework

Jsf2 overview
Jsf2 overviewJsf2 overview
Jsf2 overviewsohan1234
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Arun Gupta
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Arun Gupta
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionArun Gupta
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerArun Gupta
 
Development of web apps based on JSF (TU Vienna)
Development of web apps based on JSF (TU Vienna)Development of web apps based on JSF (TU Vienna)
Development of web apps based on JSF (TU Vienna)blahap
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGArun Gupta
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Skills Matter
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Arun Gupta
 
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...IndicThreads
 
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010Jagadish Prasath
 
Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)Chitrank Dixit
 
Java EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureJava EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureIndicThreads
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts weili_at_slideshare
 

Ähnlich wie Jsf Framework (20)

Jsf2 overview
Jsf2 overviewJsf2 overview
Jsf2 overview
 
Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6Boston 2011 OTN Developer Days - Java EE 6
Boston 2011 OTN Developer Days - Java EE 6
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ Silicon Val...
 
Struts Basics
Struts BasicsStruts Basics
Struts Basics
 
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnitionJava EE 6 & GlassFish = Less Code + More Power @ DevIgnition
Java EE 6 & GlassFish = Less Code + More Power @ DevIgnition
 
Java EE 6 = Less Code + More Power
Java EE 6 = Less Code + More PowerJava EE 6 = Less Code + More Power
Java EE 6 = Less Code + More Power
 
Development of web apps based on JSF (TU Vienna)
Development of web apps based on JSF (TU Vienna)Development of web apps based on JSF (TU Vienna)
Development of web apps based on JSF (TU Vienna)
 
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUGJava EE 6 & GlassFish = Less Code + More Power at CEJUG
Java EE 6 & GlassFish = Less Code + More Power at CEJUG
 
J2EE jsp_01
J2EE jsp_01J2EE jsp_01
J2EE jsp_01
 
14 mvc
14 mvc14 mvc
14 mvc
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
 
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3 Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
Arun Gupta: London Java Community: Java EE 6 and GlassFish 3
 
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
Java EE 6 & GlassFish 3: Light-weight, Extensible, and Powerful @ JAX London ...
 
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...Java EE 6 = Less Code + More Power (Tutorial)  [5th IndicThreads Conference O...
Java EE 6 = Less Code + More Power (Tutorial) [5th IndicThreads Conference O...
 
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
Java EE 6 - Deep Dive - Indic Threads, Pune - 2010
 
Introducing spring
Introducing springIntroducing spring
Introducing spring
 
Jsp (java server page)
Jsp (java server page)Jsp (java server page)
Jsp (java server page)
 
Java EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The FutureJava EE 6 : Paving The Path For The Future
Java EE 6 : Paving The Path For The Future
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 

Kürzlich hochgeladen

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Kürzlich hochgeladen (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

Jsf Framework

  • 1. JavaServer Pages™ /Servlets and Web Application Frameworks Doris Chen, Ph.D Staff Engineer This box provides space for call to Sun Microsystems, Inc action text, URLs, or any relevant info
  • 2. Speaker’s Qualifications ● Doris Chen – Technology Evangelist at Sun Microsystems – Develops and delivers Code Camps for J2EE, Java performance tuning, J2ME and web services technologies for Sun Microsystems – Speaks around the world concerning Sun™ technologies
  • 3. Presentation Agenda ● JSP™/Servlets Overview ● Frameworks • Struts • JavaServer™ Faces • Sun™ ONE Application Framework (JATO) ● Summary and Resources
  • 4. How It Fits Together JSF S1AF JSTL Struts JSP™ java bean, expression lang.,custom tag lib Servlet session tracking, filtering, listener
  • 5. Web Foundation: JSP™/Servlets ● Java Servlet technology since ’96, JSP 1.0 specification in June ’99 ● Servlets and JSP technologies: • JSP 1.2 and Java Servlet 2.3 technologies in the J2EE 1.3 platform (now) • JSP 2.0 and Java Servlet 2.4 technologies in the J2EE 1.4 platform (proposed final draft)
  • 6. Java Servlet Technology ● Foundation for many technologies • The JAX-RPC API • Java portlet technology • The JAXM API • Struts, JavaServer Faces™, Sun™ ONE application framework ● Well understood by industry
  • 7. The JavaServer Pages™ (JSP™) Specification ● JavaServer Pages technology: Building Block ● Mature spec ● Widely Used ● Many uses of Tag Libraries ● Very good community, look for the JSP 2.0 release
  • 8. JSP Architecture Servlet Engine Client Request JSP Translator Redirect JSP Create Response Load JSP Servlet Servlet Load Servlet JSP Servlet
  • 9. Frameworks Struts Sun™ ONE Application Framework JS L T SA 1F WAF JavaServer Faces™ (events) Server Client Request UI Response (markup)
  • 10. Presentation Agenda ● JSP™/Servlets Overview ● Frameworks • Struts • JavaServer™ Faces • Sun™ ONE Application Framework (JATO) ● Summary and Resources
  • 11. Jakarta Struts ● Struts is an open source framework developed by the Apache Jakarta project http://jakarta.apache.org/struts/ – Struts 1.02 is available and Struts 1.1 is in beta ● Struts allows: – JSP/Servlet developers to fashion their web applications using the MVC design pattern – Configure a lot of the default framework objects through xml configuration files – Run Servlet2.2/JSP1.1 container and above
  • 12. Model-View-Control (model 2) MVC Design Pattern 1 Request (Controller) Servlet BROWSER In Redirect 3 st 2 an tia te 5 (View) (Model) Java Bean Response JSP 4 Servlet Container (EIS)
  • 13. Struts: MVC Pattern Implemented Controller Model Action Action Mapping Action Servlet Request (xml) Client uses Response Action Action JSP View Forward Form Model Data View
  • 14. Struts Components and Feature ● The View - a JSP or HTML page ● The Model - a Java object ( called a ActionForm) ● Central controller – ActionServlet • URI to ActionMapping(Action class) located in struts- config.xml file • Action classes • Adaptors between business layer and web tier ● Validation, Internationalization, Custom tags for creating HTML, presentation logic, and templating
  • 15. Model ● Model classes should be coded independent of the Struts framework – Maximum code reusability by other applications ● Struts provides default Model components, most important one ActionForm • Create model class by extending the Struts ActionForm class ● Struts provides a org.apache.struts.util.PropertyUtils has a static method called copyProperties() – To copy all form properties to your original model object when your controller receives a form
  • 16. Controller ● The controller is the switch board of MVC ● Directs the user to the appropriate views by providing the view with the correct model ● The task of directing users to appropriate views is called “mapping” ● Struts framework provides a base object called org.apache.struts.action.ActionServlet
  • 17. Controller (Cont.) Http://myhost/authorize.do Server configured to pass *.do extensions to org.apache.struts.action.ActionServlet via a web.xml configuration file ActionServlet object inspects the URI and tries to match it against an ActionMapping located in the struts-config.xml file Instance of appropriate Action class is found and it’s perform() is called Action object handles the request and returns control to a view based where the user is within the flow of the application
  • 18. struts-config.xml: ActionMapping <action-mappings> <action path="/logon" type="org.apache.struts.example.LogonAction" name="logonForm" scope="request" input="/logon.jsp"> </action> <forward name="success” path="/msgBoard.jsp"/> </action-mappings>
  • 19. View ● ActionForward object tells JSP page to dispatch to ● The view in Struts is represented by JSP ● JSP can use ActionForm bean to get output Model data to display ● Struts contains a series of tag libraries – Facilitates communication between HTML designers and developers – Facilitates dynamic Web content
  • 20. View: Example 1 <%@ page language="java" %> 2 <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 3 <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> 4 <html:html locale="true"> 5 <head> 6 <title><bean:message key="logon.title"/></title> 7 <html:base/> 8 </head> ... 9 <html:errors/> 10 ... 11 <html:form action="/logon.do" focus="username"> 12 <table border="0" width="100%"> ... 13 <html:submit property="submit" value="Submit"/> 14 ... 15 </html:form> 16 ... 17 </html:html>
  • 21. Struts Example Page 1 Jsp 1 Jsp 2 Jsp 3 Web Browser Web Server Form Request/session View Jsp Engine Bean Form 1 Bean Other Layer 2 Bean 1 Controller Struts- config. xml Mappings • path Action1 Action2 Action3 Action4 • action .java .java .java .java • [form bean] • [forwards] Business Business Business Business Bean 1 Bean 2 Bean 3 Logic Layer CoreSession CoreSession Socket Data MarkVision Server Layer
  • 22. Presentation Agenda ● JSP™/Servlets Overview ● Frameworks • Struts • JavaServer™ Faces • Sun™ ONE Application Framework (JATO) ● Summary and Resources
  • 23. JavaServer Faces Design Goals ● Tool Friendly ● Client device neutral ● Usable with JavaServer Pages (JSP) ● Usable without JSP ● Useful in today's lowest common denominator browsers ● Scalable
  • 24. JavaServer Faces Requirements ● Extensible UI component model ● Flexible rendering model ● Comprehensive event model ● Powerful Validation framework ● Flexible error handling ● Basic page navigation ● Internationalization and Accessibility
  • 25. How the JSF Specification Fits In JSF App JSF App JSF Tags JSP (1.2) JSF API Servlets (2.3)
  • 26. JSF Architecture Server Request UI Client (Events) Response (Markup)
  • 27. JSF Architecture Server JSF Page HTML Desktop HM TL Browser R d it en erK Front App ctrl JSF Page Backend WL M R d it en erK Phone WML
  • 28. JSF Specification: Customers Application Extensions Tools Page Developer Author Component Developer JSF Application Implementor/ Developer Extender
  • 29. Key JSF Concepts ● UIComponent – JavaBean like classes ─ Render-independent characteristics ─ Base class with standard behaviors ● Standard UIComponent Subclasses: ─ UICommand, UIForm, UIGraphic, UIInput, UIOutput, UIPanel, UISelectBoolean, UISelectMany, UISelectOne ● FacesEvent – Base class for request and application events ● Validator – Base class for standard and application defined validators
  • 30. Key JSF Concepts ● Converter – Plug-in for String-Object conversion ● FacesContext – Per-Request State: ─ Servlet request, response, session ─ JSF request, response trees ─ Model reference expression evaluators • Syntax similar to the expression language of the JSP Standard Tag Library (JSTL) 1.0 • Primary interface between components and the data provided by (or to) the application
  • 31. Key JSF Concepts ● Renderer – Converts components to and from a specific markup language ─ Supports render-dependent attributes on components ─ May support more than one component type ● RenderKit – Library of Renderers ─ Extensible at runtime ─ Basic HTML RenderKit is part of the specification
  • 32. JSF Example 1 <%@ page language="java" %> 2 <%@ taglib uri="http:://java.sun.com/j2ee/html_basic" prefix="faces" %> 3 4 <jsp:usebean id="UserNumberBean” class=”NumberBean” scope=session> 5 <faces:usefaces> 6 <faces:form id="helloForm" forname="helloForm"> 7 <faces:textentry_input id="username" modelReference 8 ="UserNameBean.userName"> 9 10 <faces:command_button id="submitButton" label="submit"> 11 </faces:form> 12 </faces:usefaces> 13 ... 14 </html:html>
  • 33. Component Tree HelloForm Input Form text UserName Submit event Stored Queued
  • 34. Steps in Development Process ● Author the pages using the UI component tags • useBean tag • faces tags: • faces:form, faces:textentry_input, faces:command_button ● Develop the model objects, which will hold the data ● Develop navigation handlers • Define the navigation for the application by implementing ApplicationHandler class
  • 35. Current Development Status ● Warning – everything above is subject to change! ● Under development in JSR-127 ─ Introduced at JavaOne US 2001 ● Large expert group ─ Framework developers, Tools providers, ISVs ● Completed Community Draft status (07/2002) ● Working towards Public Draft release of specification
  • 36. Current Development Status ● Early Access of Reference Implementation is also available ● Early Access (pre-Public Draft) Specification available: • http://java.sun.com/j2ee/javaserverfaces/ ● JSF Public Forum: • http://forum.java.sun.com/forum.jsp?forum=427 ● JSF Comments: jsr-127- comments@sun.com ● Intranet Site: http://wspack.sfbay.sun.com/jsf
  • 37. If You Only Remember One Thing… ● JavaServer Faces is destined to become the standard mechanism for creating user interface components for J2EE based web applications.
  • 38. Presentation Agenda ● JSP™/Servlets Overview ● Frameworks • Struts • Sun™ ONE Application Framework (JATO) • JavaServer™ Faces ● Summary and Resources
  • 39. Sun™ ONE Application Framework (JATO) Overview ● A J2EE application framework • Primarily focused on web tier • Leverage Sun Java Center J2EE Patterns ● Provide a robust, scalable application foundation • Application composition via reusable components • Full-featured event model and high-level tag library ● SOAP & Web Services support / integration ● Leveraged through Sun ONE Studio Wizard- based visual interfaces
  • 40. Where can the Sun ONE Application Framework be used? ● Enterprises or ISV's building large enterprise web applications ● Large development team (10+) focused on web applications ● Few really know Java APIs at the web tier or enterprise tier
  • 41. Sun ONE Application Framework (JATO) Platform Stack
  • 42. S1AF and Your Application
  • 43. J2EE Design Pattern ● Leverage Sun Java Center J2EE Patterns • Best practice design patterns for J2EE development • Fine grained patterns • Can be combined into a complete MVC ● Use Model View Controller pattern (MVC)
  • 44. J2EE patterns used in S1AF ● Business delegate ● View helper ● Composite view ● Service to worker ● Front controller
  • 45. Sun ONE Application Framework
  • 46. Models ● Implements Business Delegate pattern – Reduce coupling between presentation tier clients and business services – Hides the underlying implementation details of business service (e.g. JDBC details) ● Provides developers a common interface for using any Enterprise resource – Web Service resources – Database resources – UIF (Enterprise Connectors) resources – J2EE Connector Architecture resources – AND 3rd party created
  • 47. Views ● A union of JSP tags with S1AF view objects – S1AF JSPs use S1AF tags and othe 3rd party tags – S1AF views simply refer to model data ● Implements J2EE view helper pattern – S1AF views allows JSPs to remain Java-free – Presentation logic is placed in View class – More than one JSP can use a View Helper • Allows for variable content rendering ● Implements J2EE Composite View Pattern – S1AF view may be arbitrarily nested
  • 49. Controller ● Consistes of two patterns – Front controller – Service to workers ● Implements front controller pattern – All requests pass through front controller – Module servlet serves as front controller – Single point of entry allows for centralization of certain types of logic
  • 50. Controller (Cont.) ● Implements ServiceToWorker pattern – Single service dispatches to request specific controllers(workers) • All requests pass through the FrontController • Controller logic can be partitioned into more fine grained units for scalability and logical partitioning – S1AF module servlet dispatches request to the appropriate worker (controller) • S1AF controller can be a Command interface • Developers will implement the command interface
  • 51. Tool & Wizard Friendly
  • 52. View Components ● “ Out of the box” Page components are available such as Button, Check Box, Combo Box ● 3rd party (SI’s) components can be dynamically added to the product
  • 58. Presentation Agenda ● JSP™/Servlets Overview ● Frameworks • Struts • JavaServer™ Faces • Sun™ ONE Application Framework (JATO) ● Summary and Resources
  • 59. JSF, Struts and S1AF ● Focus is a bit different – Struts: encapsulates user-interface more at form or page level – JSF: UI components, component model for user-interface, Tools focus – S1AF: extends MVC and J2EE design pattern and comes with an extendable but ready-to use base implementation, visual builder tool ● Some overlap – Use the parts that are helpful, ignore the parts that are not – Pick solution best suited to expertise/task – JSF/Struts integration http://jakarta.apache.org/builds/jakarta-struts/nightly/struts- faces/
  • 60. JSF, S1AF, and Struts ● All three communities are represented on JSR-127 expert group – The lead developer of Struts, Craig McClanahan, now works for Sun and is a member of JSF expert group – S1AF Architect is already participating in expert group meeting – Long term strategy: ● S1AF and struts will co-exists/merge with S1af evolving to use struts controller technology and JSF components ● Goal is to provide a single web-based framework also monetizes struts technology
  • 61. Where to look further ● JSF http://java.sun.com/products/j2ee/javaserverfa ● Struts http://jakarta.apache.org/struts ● A good place to start is the S1AF-Tips group: http://groups.yahoo.com/group/iPlanet-JATO- Tips/ ● FAQ of the larger community forum at: http://groups.yahoo.com/group/iPlanet -JATO/ ● The Whitepaper: http://ias.red.iPlanet.com/jato ● You can get more information at: http://developer.iPlanet.com/tech/appserver/fr amework/index.jsp
  • 62. JavaServer Pages™ /Servlets and Web Application Frameworks Doris Chen, Ph.D doris.chen@sun.com