TD GEN Web2 0 JSF Creator
Transcript of TD GEN Web2 0 JSF Creator
-
8/14/2019 TD GEN Web2 0 JSF Creator
1/45
Technologies and Toolsfor Web 2.0:
JavaServer Faces andCreator
-
8/14/2019 TD GEN Web2 0 JSF Creator
2/45
Agenda
JavaServer Faces: Quick Overview
Java Studio Creator> Demo
Visual Web Pack over NetBeans 5.5
-
8/14/2019 TD GEN Web2 0 JSF Creator
3/45
JavaServer Faces:JavaServer Faces:
Quick OverviewQuick Overview
-
8/14/2019 TD GEN Web2 0 JSF Creator
4/45
The Classic Definition
JavaServer Faces is a
server side, user interfacecomponent framework for
building Java technologybased web applications.
-
8/14/2019 TD GEN Web2 0 JSF Creator
5/45
Core Concepts
Workflow
Components
Converters / Validators
Events
Binding expressions
Application Interface
Navigation Rendering
Managed Bean Creation
-
8/14/2019 TD GEN Web2 0 JSF Creator
6/45
JSF Architecture
Client
Server
UIRequest(events)
Response(markup)
-
8/14/2019 TD GEN Web2 0 JSF Creator
7/45
Workflow Maps closely to web application workflow
> Pages composed of components> Page flow described by flexible XML syntax> JavaBeans concepts leveraged for Data Integration
UIIput id=guessNum
UICommand id=submit
View Root
Form id=guess
Backing Bean
getUserNumber()
setUserNumber(..)
guess()
Business
Delegate
guess()Next view XML File
-
8/14/2019 TD GEN Web2 0 JSF Creator
8/45
Components
Contains the current state of a component:> Visual appearance characteristics> Bindings to model tier data and event handlers> May have validators, converters and event listeners
attached to them Implemented as a classic JavaBean:
> Properties state characteristics> Methods encapsulated behavior exposed to apps> Events respond to UI related events
Composed into a component tree per logical view> Single view root component
> Arbitrary levels of nesting for child components
-
8/14/2019 TD GEN Web2 0 JSF Creator
9/45
Components
So... what is a component?> To a page author JSP custom tag(s)
> To a component writer JavaBean(s)
ComponentClass
Custom
Tag
Renderer
-
8/14/2019 TD GEN Web2 0 JSF Creator
10/45
Converters / Validators
Converters Plugins for conversion> Maximum of one converter per component> Explicit (by id) or implicit (by type) registration
> Output object to string> Input string to object> Standard implementations included
Validators correctness checks on input values> Built in (to component) validation> Register one or more external validators> Standard implementations included
-
8/14/2019 TD GEN Web2 0 JSF Creator
11/45
-
8/14/2019 TD GEN Web2 0 JSF Creator
12/45
Value and Method Binding (cont.)
Method binding expressions:> Great for tools if we could reference methods in a single
backing bean class>
Syntax follows value binding expression:({mybean.mymethod})> Last element identifies a public method
-
8/14/2019 TD GEN Web2 0 JSF Creator
13/45
Events
Standard JavaBeans design patterns
Strongly typed listener registration> Register one or more listener implementations
Standard events and listeners> ActionEvent UI component was activated> ValueChangeEvent Input component's local value has
changed and it has been validated
Framework has default ActionListener
-
8/14/2019 TD GEN Web2 0 JSF Creator
14/45
Events and Listeners: MethodBinding UICommand actionListener
> Method acts like ActionListener.processAction()
UIInput validate
> Method acts like Validator.validate() UIInput valueChangeListener
> Method acts likeValuechangeListener.processValueChange()
UICommand action> Method is called when an action event occurs
-
8/14/2019 TD GEN Web2 0 JSF Creator
15/45
Application Interface
Page author references the business logic method to beexecuted:
-
8/14/2019 TD GEN Web2 0 JSF Creator
16/45
Navigation
Navigation decisions externalized to pluggableNavigationHandler
Decision outcome is the name of the view to bedisplayed next:> Details are dependent on ViewHandlerinstance in use> Most common use case - view == JSP page
Default NavigationHandlerimplementation bases
decision on:> Which view is being processed> Which logical outcome was returned by invoked action
Navigation rules configured in faces-config.xml
-
8/14/2019 TD GEN Web2 0 JSF Creator
17/45
Login Screen Navigation
Example
login.jsp
new_usr.jsp
error.jsperror.jsp
menu.jsp
succe
ss
newusererr
or
from-view
to-view
from-outcome
-
8/14/2019 TD GEN Web2 0 JSF Creator
18/45
Navigation
*
searchHandler.go
success
/search-results.jsp
-
8/14/2019 TD GEN Web2 0 JSF Creator
19/45
Managed Bean Creation
The previous code samples showed references tologonBean
Faces tries to find this bean in any scope:
> Request> Session> Application
If not found, optionally:> Instantiate a bean of a specified class> Store bean instance in a specified scope
Configuration rules specified in faces-config.xml
-
8/14/2019 TD GEN Web2 0 JSF Creator
20/45
Managed Bean Creation
logonBean
mypackage.LogonBean
request
creditLimit#{initParam.defaultCreditLimit}
-
8/14/2019 TD GEN Web2 0 JSF Creator
21/45
Binding UI to Managed Bean
login.jsp
faces-config.xml
LoginFormBean
myapp.LoginFormBean
LoginFormBean.javapublic class LoginFormBean
...
public void setUserName(...){
public StringgetUserName(...) {
-
8/14/2019 TD GEN Web2 0 JSF Creator
22/45
Rendering Model> Renderers Adapt components to aspecific markup
language> Encoding Create markup to represent component value
> Decoding Interpret request parameters to update componentvalue
> RenderKit a library of Renderers> defines how component classes map to component tags
appropriate for a particular client> Extensible at runtime
> ForJSP pages, represented as a custom tag library
> Basic HTML RenderKit part of the standard
Button
Link
-
8/14/2019 TD GEN Web2 0 JSF Creator
23/45
Sample JSFTM Page
1: 2: 3: 4:
5: 6: 7: 9:10: 13: < >
-
8/14/2019 TD GEN Web2 0 JSF Creator
24/45
View Tag Hierarchy
-
8/14/2019 TD GEN Web2 0 JSF Creator
25/45
Lifecycle
-
8/14/2019 TD GEN Web2 0 JSF Creator
26/45
JavaServer Faces 1.2 New Feature
Alignment with JSP technology> Support of JSTL's forEach tag with Faces components> Improvements in tree creation and content interweaving> In favor of the unified EL
Ease-of-use improvements in support for custom
messages> New requiredMessage, converterMessage, andvalidatorMessage Attributes
Improved state-saving behavior> Solving state becoming disoriented when uses multiple frames> encrypt client-side state before send to the client
Ability to turn off generation of component client IDs New setPropertyActionListener Tag
> register a special action listener to the ActionSource instance
associated with a component
-
8/14/2019 TD GEN Web2 0 JSF Creator
27/45
Java Studio CreatorJava Studio Creator
-
8/14/2019 TD GEN Web2 0 JSF Creator
28/45
Sun Java Studio Creator Benefits
Rapid, visual web application & portlet developmentusing JavaServer Faces components
Your choice:> Windows, SolarisTM, Linux, Mac OSX
Offers Complete Development Environment
Full Visual Development Support
Comprehensive UI Component Support AJAX Support
Simplified Application Model
Simplified Data Access
-
8/14/2019 TD GEN Web2 0 JSF Creator
29/45
Features (1 of 4) Complete development environment
> Sun JavaTM System Application Server PE> Sample DB> Sample applications (new)
Bundled database> Java DB (Derby)> Allows us to ship working examples with the IDE> Provides database support for prototyping
Support for coding at level you're comfortable with> Visually in Designer> Directly in JavaServer Pages (JSP)
> In Java
-
8/14/2019 TD GEN Web2 0 JSF Creator
30/45
Features (2 of 4)
Rich library of JavaServer Faces components (new)> e.g. table, calendar, tree, tab set, file upload, and manymore
> Validators and converters
Query Editor> Visually create SQL queries including joins, where
clauses, criteria, etc.
DataProviders (new)> Bind components to a variety of data> Enables drag-and-drop Web Service and EJB method
binding
-
8/14/2019 TD GEN Web2 0 JSF Creator
31/45
Features (3 of 4) Built on NetBeans
> Rich Java Editor> Code Completion> Debugger> HTTP Monitor
> Refactoring> Projects
Stylesheet Editor> Visual CSS development (new)
Page Navigator> Point and click to define user flow
Virtual Forms
> dealing with multiple input scenarios in a single page
-
8/14/2019 TD GEN Web2 0 JSF Creator
32/45
Features (4 of 4)
Export WAR> i.e. WAR can be deployed to a number of containers
including Sun Application Server, WebLogic,WebSphere, Tomcat, etc.
Full support for JSR-168 JavaServer Faces portletdevelopment.> Modes, Preferences, Portlet Config
Design-Time APIs(new)> Enables excellent design-time experience with third-party
JavaServer Faces components (e.g. Otrix, Software FX,ILOG, JSCAPE, among others)
-
8/14/2019 TD GEN Web2 0 JSF Creator
33/45
Components provide AJAX support> Javascript and Servlet details already worked out> Complicated communication details hidden>
Makes AJAX a commodity
AJAX Support
-
8/14/2019 TD GEN Web2 0 JSF Creator
34/45
Sample Sun BluePrints AJAX Components Provided> Auto Complete Text Field> Map Viewer (uses Google Map API)> Progress Bar
> Rich Textarea Editor (provides word processing features)> Select Value Text Field> Buy Now Button (PayPal purchase)> Rating> Popup Calendar
AJAX Support
-
8/14/2019 TD GEN Web2 0 JSF Creator
35/45
DemoDemo
-
8/14/2019 TD GEN Web2 0 JSF Creator
36/45
Visual Web PackVisual Web Pack
over NetBeans 5.5over NetBeans 5.5
-
8/14/2019 TD GEN Web2 0 JSF Creator
37/45
Visual Web Pack
Provides the visual drag and drop web applicationdesign experience, similar to Sun Java StudioCreator 2
Fully integrated with the NetBeans 5.5 IDE> Which means you get take advantage of:> Java SE 5
> Java EE 5
> JAX-WS> EJB 3.0
> Java Persistence API
-
8/14/2019 TD GEN Web2 0 JSF Creator
38/45
Visual Web Pack
Sample of features included in 5.5:> JSF 1.2 support> One-click deployment to Glassfish, JBoss, and Tomcat> Visual Web Page Designer
> Visual Database Binding to Components> Visual Page Navigation> Visual Data Binding> Visual Query Editor
Planned For Future Releases:> EJB 3.0 Consumption (Definition and Drag-n-Drop
binding)
> Web Service Consumption (Drag-n-Drop binding)
-
8/14/2019 TD GEN Web2 0 JSF Creator
39/45
Current Status JavaServer Faces 1.1.01 Final
> http://java.sun.com/j2ee/1.4/download.html> http://java.sun.com/javaee/javaserverfaces/download
.html
JavaServer Faces 1.2 is part of Java EE 5
> http://java.sun.com/javaee/> https://glassfish.dev.java.net/
Free!!! Sun Java Studio Creator 2 update 1plus
Sun Developer Network (SDN) membership
> http://developers.sun.com/prodtech/javatools/jscreator/downloads/index.jsp
-
8/14/2019 TD GEN Web2 0 JSF Creator
40/45
Summary
JavaServer Faces is part of JavaEE 5
Use Creator to ease the development of
JavaServer Faces Application
-
8/14/2019 TD GEN Web2 0 JSF Creator
41/45
For More Information http://java.sun.com/J2EE/javaserverfaces/
> Official site from Sun> Links to content rich discussion forum
http://www.jsfcentral.com/>
Links to implementations, renderkits, components> News stories featuring JSF.
http://jakarta.apache.org/builds/jakarta-struts/nightly/struts-faces/
> Struts integration library http://www.sun.com/jscreator/
http://forums.java.sun.com/forum.jsp?forum=427 Online
forum (free registration required)
-
8/14/2019 TD GEN Web2 0 JSF Creator
42/45
Getting Started With Creator http://developer.sun.com/jscreator
> Sample Applications> Tutorials
Questions/Problems
> Start With Forum> Search Blogs (Google site blogs.sun.com)> Sun Developer Expert Assistance
> Sun Services Feedback We Really Do Listen!
> Web Site - [email protected]> Docs - [email protected]
http://developer.sun.com/jscreatormailto:[email protected]:[email protected]://developer.sun.com/jscreator -
8/14/2019 TD GEN Web2 0 JSF Creator
43/45
Technologies and Toolsfor Web 2.0:
JavaServer Faces andCreator
-
8/14/2019 TD GEN Web2 0 JSF Creator
44/45
Developer Training
GetCertified
Buildyour
skills
Assessyo
urskillgaps
Unders
tandyour
goals
Training
Java and web services Solaris appdevelopment Middlewaredevelopment with Sun
Java Enterprise System Building apps using SunStudio 11, NetBeans,and Sun Java StudioCreator
www.sun.com/trainingCertification
Industry recognizedcertifications in Java
www.sun.com/training/certification
Support your career and
your organization's goals
1 M developers trained300 k Java certifications granted
-
8/14/2019 TD GEN Web2 0 JSF Creator
45/45
Sun Offers Comprehensive Support for Developers Sun Developer Forums Community & Sun. http://forum.sun.com Incident support for Java, Developer Tools and Solaris
> For as little as $99 get answers to your programming questions> Solaris incident support is free till October 31st.
Sun Software Services Plans for Developer Tools> Unlimited incidents, bugs and escalations, telephone support> 5x12 or 7x24 worldwide
Sun Developer Service Plans for Java and Developer Tools> Get how-to incident help, Unlimited bugs/escalation, telephone
support and Sun Training credits> 5x12 or 7x24 worldwide
Java MultiPlatform 7x24 Enterprise Java Support for Linux and
Windows> Get your run-time Java issues addressed in the release you want touse
> Comprehensive run time support for your Java deploymentenvironment
> Make $$ by providing front-line Java support to your customers