Recent Posts

RSS Feeds

making faces (i.e. JSF)


Just finished lunch, before lunch I went to Stephen Stelting talk on JSF. It was good, the example was cool because he walked through a lot of stuff.

here are my notes

Needed

  • J2SE 1.3.1 or later
  • Servlet 2.3
  • JSP 1.2

Jwsdp 1.2 has tomcat built in

Jsf-api.jar, Jsf-ri.jar, Jstl.jar, Standard.jar, Commons-beanutils.jar, Common-collections.jar, common-digester.jar, common-logging.jar

 

Five steps

1)    web.xml file must include JSF mapping

2)    copy .jar files to web-inf/lib

3)    web app must have app config file called web-inf/faces-config.xml (default name)

4)    web app must invoke FacesServlet before using JSF features

5)    jsp’s must be setup to use JSF

 

Technically you can map the faces Servlet to anything you want. Not sure that is true from my experiments.

 

Key Concepts

1)    JSF request processing model

a.     FacesServlet

b.     Lifecycle

2)    JSF Global Configuration

3)    Component model

 

Lifecycle: FacesServlet controls the lifecycle, it marshals resources and calls crucial methods. Sepcifically:

1)    get faces context

2)    get lifecycle object

3)    call the lifecycle methods

4)    releases the context

The context gives me a way to access services from the faces framework.

Lifecycle:

1)    builds or rebuilds a JSF component tree

2)    applies request values to components

3)    processes validations for new request values

4)    update model values

5)    invokes app behavior

6)    renders the response

 

Faces Config:

The default name is faces-config.xml file you can switch names and have multiple files that configure the app.

1)    Nav Rules (declartive page flow)

2)    Java Bean components

3)    Render kits

4)    Converters and Validators

5)    Custom UI Components

Components:

Graphical behaviour is managed through UI components

Basic behavior is defined in UIComponet and UIComponentBase

 

Components can use the following API’s for extended functionality

1)    Converts – change values from String to another format

2)    Listeners/Events

3)    Validators

4)    Renderers

 

Actions in JSF are meant to do stuff not manage page navigation. The page nav is managed in the faces-config.xml.

 

The event model does not do any client side events, the event model runs only on the server. You could however hack something together if you needed to.

 

Validators:

Make the data valid before it gets sent to the server.

 

Render:

Makes HTML from components.

 

Benefits of JSF include

1)    component functionality

2)    support for event-based notification on the server

3)    support for i18n and I10n

4)    XML config of things like nav

5)    Built-in integration with beans (model components)

6)    Variable representation of UI components (renderers)

7)    Easy integration with builder tools

 

Drawbacks with JSF

1)    Non-trival seup

2)    Complex processing cycle for each jsf request

3)    Performance cost to use JSF

I disagree with most of these. The setup is straightforward, the cycle is more or less transparent for most developers. The performance cost was hedged with the fact that any framework is going to cost some performance for other tradeoffs.

 

Demo of JSF:

1)    basic form elements

2)    association with model elements

3)    event notification

4)    page navigation

5)    internationalization

Tons of info about JSWSDP.

 

A discussion of common errors and the way they show up. This was really useful I think for the developer just getting started. Good idea to put into a talk.

 

Lots of cool examples that showed all the stuff discussed above.

Permalink     No Comments



Post a Comment:
  • HTML Syntax: Allowed