discussing some technical aspects covering tools, frameworks, technologies etc (the areas where i m involved and getting experienced) - feel free to discuss!

Tuesday, May 02, 2006


Java Server Faces Notes
- M Raghavan alias Saravanan, 13Jan2006 Friday 5:25 PM

--> JSF - is mainly used to develop the custom UI Parts in any application in a neutral manner.
(*)to create a standard framework for user interface components for web applications
(*)JSF lets you build web applications that run on a Java server and render the user interface back to the client
(*)provides web application lifecycle management through a controller servlet, and a rich component model with event handling and component rendering
--> Though it also follows MVC 2 pattern (separation of presentation logic and business logic) its focus is fully into the VIEW tier, where as
--> Struts is concentrating mainly on the Controller tier. But still there are some overlaps are there between these two frameworks.
--> Integration of these two frameworks is in progress. See Apache site for the same.

--> Works with the Servlet 2.3 or more and JSP 1.2 or more

Two Main Components of JSF:
(1) Java APIs to represent UI Components, manage state, handle events, and validate Input. (Internationalization and accessibilty!)
(2) Two JSP Custom tag libraries for expressing user interfaces (UI) components within a JSP page and for writing components to server-side objects. Page authors can easily add UI components to their pages.

The UI parts are rendered on the Server and then the rendered output (HTML Of course as most of the clients - browsers are relying on HTML as the Least Common Denominator) is sent to the client on the first.

Browser---->(request for a jsp page for ex) ----> form.jsp ----> UI ===> Form rendered with the components

Guidelines/Rules to Use
--> In order to user JSF tags, you need to include the taglib directives to the "html" and "core" tag libraries that refer to the standard HTML renderkit library and the JSF core tag library, respectively
--> A page containing JSF tags is represented by a tree of components whose root is the "UIViewRoot", which is represented by the "view" tag. All component tags MUST BE ENCLOSED in the "view" tag. Other content such as HTML and other JSP pages can be enclosed within that tag.
--> A typical JSP page includes a form, which is submitted when a button is clicked. The tags representing the form components (such as textfields and buttons) MUST BE NESTED inside the "form" tag.

(1) Value-binding expressions (syntax: #{bean-managed-property}, eg: value="#{UserNumberBean.minimum}")
(*) minimum is the attribute in the bean class UserNumberBean
Method-binding expressions (syntax: #{method-name-of-the-bean-to-validate}, eg: validator="#{UserNumberBean.validate}")
(*) validate is the method in the bean class UserNumberBean

The Model Object
--> A typical JSF application uses a bean with each page in the application.
--> The bean defines the properties and methods associated with the UI components used on the page.
--> A bean can also define a set of methods that perform functions, such as validating the component's data, for the component.
--> The model object bean is like any other JavaBeans component: it has a set of accessor methods.

Application Configuration Resource File
An application configuration resource file, "faces-config.xml", is used to define your managed beans, validators, converters, and navigation rules

Faces Servlet
(*) has to be configured in web.xml (similar to ActionServlet in Struts)

--> in order to use the JSF framework in your web applications, you need to define the "FaceServlet and its mapping" in your deployment descript file, web.xml.
--> This servlet "acts as the FRONT CONTROLLER" and handles "all JSF-related requests"

JSF Components are organized into categories
--> Added Components: JSF components you have written or acquired elsewhere and imported into the Java Studio Creator development environment
--> JSF Standard Components: The basic set of components including form fields, hyperlinks, labels and text. The JSF components are organized into logical groups by function.
--> JSF Validators/Converters: Components that modify or validate data in other components but are not themselves displayed
--> Advanced: JSP tags for advanced JSF features. These tags generally do not have a visual appearance and are only useful if you are familiar with both the JSP and JSF technologies.

(*) JavaServer Faces (JSF) is a user interface framework for building web applications that run on the server side and render the user interface back to the client.
(*) It lets you develop tools that simplify coding web-based Java applications

(*) JSF requires little more effort than an ordinary JSP configuration -- but with many more benefits

No comments:

About Me

ஏதோ பிறந்தோம், ஏதோ வாழ்ந்தோம் என்றிருப்பதல்ல வாழ்க்கை! எப்படி வாழ்ந்தோம் என்பதும் ஒரு அங்கம். வாழக் கிடைத்த வாழ்க்கையில், ஒரு சிலருக்காவது வசந்தத்தின் முகவரியை அறிமுகம் செய்தோமேயானால் அதுவே வசீகரத்தின் வனப்பைக் கூட்டும்!