java server faces tutorial ppt and java server faces tutorial for beginners
LexiWills,United Kingdom,Professional
Published Date:31-07-2017
Your Website URL(Optional)
Comment
Struts and JavaServer Faces
Ken Paulsen
Staff Engineer
Sun Microsystems, Incorporated
(Slides by Craig McClanahan)Agenda
●
Brief description of JavaServer Faces
●
Struts or JavaServer Faces?
●
Future directions
●
Summary
●
Creator Demo
2 Struts and JavaServer FacesJavaServer Faces Is ...
A server side user interface
component framework for
Java-based web applications
3 Struts and JavaServer FacesBackground
●
Web applications a popular entry point
for developers new to Java
●
Powerful foundational technologies:
–
Servlet API
–
JavaServer Pages (JSP)
–
JSP Standard Tag Library (JSTL)
–
Portlet API
●
But no common component standard
4 Struts and JavaServer FacesBackground
●
Web applications also represent a key
opportunity to attract a new developer
market segment to Java
–
Corporate developers
●
Attracting this population required
something different
–
Ease of use is the 1 criteria
5 Struts and JavaServer FacesFundamental Requirements
●
Accessible to corporate developers
●
Accessible to tools
●
Client device neutral
●
Usable with or without JSP
●
Usable with or without HTML
●
Scalable to enterprise applications
6 Struts and JavaServer FacesBasic Capabilities
●
Extensible user interface (UI)
component model
●
Flexible rendering model
●
Event and listener handling model
●
Per-component validation framework
●
Basic page navigation support
●
Internationalization and accessibility
7 Struts and JavaServer FacesArchitecture Overview
●
UIComponent – Basic component API
–
JavaBean class with default base
implementation class (UIComponentBase)
–
Contains render-independent properties
●
Standard generic components:
–
Examples: UICommand, UIInput, UIOutput
●
Concrete component subclasses with
HTML-specific properties and behaviors
8 Struts and JavaServer FacesValue Binding Expressions
●
Components may have a local value
–
Rendered at output time
–
Updated on subsequent form submit
●
Components may be bound to a model
tier value
–
customer.address.city
–
Syntax based on JSTL/JSP 2.0 EL
–
Semantics identical when rendering
●
Nearly all properties may be bound
9 Struts and JavaServer FacesMethod Binding Expressions
●
Specialized version of value binding
expression
●
Last element of the expression points
at a method instead of a property
●
Used to bind command components to
the corresponding action method that
should be called when component is
activated
10 Struts and JavaServer FacesEvents and Listeners
●
Standard JavaBeans event pattern
●
Strongly typed events and listeners
●
Two standard events:
–
ActionEvent – broadcast when a UICommand
component is activated by the user
–
ValueChangeEvent – broadcast when a UIInput
component has been validated, and the new
value differs from the old value
11 Struts and JavaServer FacesConverters and Validators
●
Converters – Plugins for String-Object
conversion
–
Render time – Object to String
–
Update time – String to Object
●
Validators – Plugins for correctness
checking
●
Default implementations for common
use cases
12 Struts and JavaServer FacesApplication Interface
●
JavaServer Faces provides a default
ActionListener for every UICommand
–
UICommand may contain a method binding to
an action method to be executed
–
Each UICommand may have its own method, or
they may share
–
Action method invoked “immediately” or after
validation
–
Return logical outcome used for navigation
13 Struts and JavaServer FacesPage Navigation Model
●
Pluggable NavigationHandler called to
perform navigation duties
●
Default implementation uses
configured navigation rules based on:
–
What page submitted this form?
–
Which action method was invoked?
–
What logical outcome was returned?
●
Result: navigate to new page or
redisplay old page
14 Struts and JavaServer FacesManaged Bean Creation Facility
●
In a value binding or method binding
expression, the first element is special
–
“Magic” values – provide access to request or
application data
–
“Non-magic” values – search request, session,
and application scope (like jsp:useBean)
–
If not present, automatically instantiate a
bean, put it in scope, and populate properties
●
Generalized verison of Struts form
beans
15 Struts and JavaServer FacesBusiness Logic In Backing Beans
●
Most JavaServer Faces applications will
organize event handling code for a
particular form into a corresponding
JavaBean class (“backing bean”)
●
Typical backing bean is also a
managed bean, put in request scope
●
Similar in concept to ASP.Net “code
behind files”
16 Struts and JavaServer FacesRequest Processing Lifecycle
17 Struts and JavaServer FacesJSF In Action
●
The JSF RI ships with several samples
–
samples/jsf-cardemo.war
●
Can be dropped into any Servlet 2.3 /
JSP 1.2 (i.e. J2EE 1.3 or later) container
●
We will see a demo using Creator
18 Struts and JavaServer FacesAgenda
●
Brief description of JavaServer Faces
●
Struts or JavaServer Faces?
●
Future directions
●
Summary
●
Creator Demo
19 Struts and JavaServer FacesStruts or JavaServer Faces?
●
Long answer on Craig's blog:
–
http://blogs.sun.com/roller/page/craigmcc
–
/20040927struts_or_jsf_struts_and
●
Strusts and JSF provide 2 architectures
for building Model 2 based webapps
●
But is it an either-or choice?
●
No – You can use them together
20 Struts and JavaServer Faces
Advise:Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.