Web Design & Development - CS506 Power Point Slides Lecture 44
Web Design & Development - CS506 Power Point Slides Lecture 44
• Clientside validation
• Show problems
– State example (search page don’t show back
results)
– Event Model (swing example , now tags data
need to be parsed)
– Validation model
– We are doing a lot of low work ourselves (e.g.
request.getParameter etc). Need a framework
Client Side validation
Example
(NI)
– Tapestry
– JSF
JavaServer Faces
UI Component Model
Rendering Model
APIs And Programming
Server Side UI Event Handling Model
Internationalization
Java Server Faces –
Major Features (NI)
• Components
– Allows creation of user interfaces from a set of standard, reusable
server-side components
• Provides JSP tags to access those components
– representing UI components
– managing their state
– handling events
– input validation
– Data binding
– Automatic conversion
– defining page navigation
– supporting internationalization and accessibility.
Enhanced Productivity
for UI design (NI)
• Page level RAD
• Listener Handlers
– Implement UI logic
– Have access to event source
– Do not participate in navigation handling
• Action Handlers
– Implement business logic
– Don’t have access to action source
– Returned outcome affects the navigation handling
JSF – Multiple Event
Handlers (NI)
<h:selectOneMenu value=“#{customer.country}”
<f:valueChangeListener type=“com.comp.CntrListener”
<f:valueChangeListener type=“com.comp.CCListener”
</h:selectionOneMenu>
<h:commandButton action=“#{search.doSearch()}”>
<f:actionListener type=“com.comp.AAciontListener” />
<f:actionListener type=“com.comp.BActionListener” />
</h:commandButton>
• Example Hello User
JSF Validators (NI)
• DoubleRangeValidator
– Any numeric type, between specified maximum and
minimum values
• LongRangeValidator
– Any numeric type convertible to long, between
specified maximum and minimum values
• LengthValidator
– String type, between specified maximum and
minimum values
JSF Validators (NI)
– representing UI components
– managing their state
– handling events
– input validation
– Data binding
– Automatic conversion
– defining page navigation
– supporting internationalization and accessibility.
JSF – Managed Bean-
Intro
Value Binding:
<h:outputText rendered=”#{user.manager}”
value=”#{employee.salary}”/>
JSF – Value Binding
<navigation-case>
<description>Handle case where login succeeded.</description>
<display-name>Successful Login</display-name>
<from-action>#{userBean.login}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/home.jsp</to-view-id>
</navigation-case>
<navigation-case>
<description>User registration for a new user succeeded.</description>
<display-name>Successful New User Registration</display-name>
<from-action>#{userBean.register}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
• Example Here of two numbers
• EXAMPLE HERE
• After that “to pta yai chala”
JSF Component
Event
Handling Render
Model
binds has
has
Id has has
UIComponent Validators
Local Value
Attribute Map
has
has
Child
Converters
UIComponent
JSF MVC Model
Model
Model
View Controller
Servlet Container
Client
Devices JSF Application
Phone
Application DB
Logic
PDA JSF Framework
• Stylesheets Integration
– Most HTML tags have one or more attributes (style, styleClass) for passing style
information
<h:outputText styleClass=“header” value=“#{bundle.welcome}” />
• Technical
– http://www.google.com
– http://forum.java.sun.com/forum.jspa?forumID=427
• Political (Sun, IBM, Oracle)
• Most IDEs have limited JSF support
Eclipse* IntelliJ* JBuilder Netbeans*
(WYSIWYG)
IBM WSAD Studio Creator JDeveloper Notepad**
(WYSIWYG) (WYSIWYG) (WYSIWYG)
(the end)
Books (NI)