Composition of JavaServer Faces applications
A JavaServer Faces application is like other web-based Java applications, running in the Java Servlet container, including the following:
JavaBeans Components (or Model Objects) contain unique features and data
Event Listener
JSP page
Server-side secondary class
Tag Library used to express UI components
Tag Library (Tag Library) used to indicate event handlers and data check (Validator)
The UI component is used to indicate the status of the server (stateful objects)
Data Veridators, event handlers, and navigation handlers. (Validators is used to provide check of component data before server-side updates.)
JavaServer Faces provides an HTML-based component tag library as a reference implementation. Senior developers can develop their own component tag libraries to represent custom components.
JavaServer Faces Reference Implementation provides a custom tag library that exhibits components in HTML. Below is a simple example of using this tag library. If the reader wants to know all the components tags it support, refer to JavaServer Faces specification and tutorial.
<% @ Taglib Uri = "http://java.sun.com/jsf/html" prefix = "h"%>
<% @ Taglib URI = "http://java.sun.com/jsf/core" prefix = "f"%>
h: form>
f: USE_FACES>
This implementation of the JavaServer Faces component architecture enables the functionality of the component to be defined in the component class, and the representation of the component can be provided by the other party. A render kit is defined for a specific client, how the component class is accurately mapped to component tags. The JavaServer Faces reference implementation provides such a kit, but it can only manifest the component to the HTML client. In HTML Renderkit, each JSP component contains two parts, the component features defined in the UIComponent class, in the performance characteristics of the components (RENDERER). For example, Command_Button and Command_HyperLink are used to represent a UIComponent, but they represent different ways. The Button component is represented as a button, and the HyperLink component is represented as a super connection. Start using JavaServer Faces
To develop using JavaServer Faces, you have to install (Java WSDP 1.0_01) or Tomcat4.0 .
JavaServer Faces Reference The preview of the implementation (EA3) can be downloaded from here. When you decompress, you will have a similar directory structure (Windows Platform):
C: / JSF-EA3>
EXAMPLE
Lib
Other files
The example subdirectory is the source file and WAR file file of the sample application. In the lib subdirectory, some JAR file files must rely on, and we will introduce:
Commons-beanutils.jar: Some utilities define and access JavaBeans properties
Commons-Collections.jar: Expansion of Collectes Framework
Commons-digester.jar: Used to process XML documents
Commons-logging.jar: a utility that flexible log log
JSF-API.JAR: Contains Javax.Faces. * API class
JSF-ri.jar: Classes containing JavaServer Faces reference implementation
JSTL.jar: Contains JavaServer Pages Standard Tag Library (JavaServer Pages Standard Tag or JSTL)
JSTL_EL.JAR: Contains classes used to process JSTL expressions
Standard.jar: Useful to use JSTL
Note that the reference implementation of JavaServer Faces is a preview (EA), just a simple implementation of the specification, that is, it is not very mature. In addition, the reference implementation of JavaServer Faces is now working with Java WSDP 1.1. If you use JavaServer Faces in Java WSDP 1.1, you will throw an exception when running, as shown below:
Figure 2: JavaServer Faces Reference Implementation with Java WSDP 1.1 cannot work together (click to enlarge)
If you don't have Java WSDP 1.0_01 and if you want to play JavaServer Faces, then I suggest you use Tomcat, all of this article is based on Tomcat-4.1.24. When you complete Tomcat installation, type http: // localhost: 8080 in your browser, if there is no problem, then Tomcat's default page will appear. Let's take a look at the example given by JavaServer Faces. Very simple, copy the WAR file under the C: / Path-to-JSF-Installation directory to your WebApps subdirectory of your Tomcat installation directory. Type http: // localhost: 8080 / demo-name to run an example program. For example, I copied Cardemo.war into the webapps directory, then entered http: // localhost: 8080 / cardemo in the browser, the picture below is my result: Figure 3: JavaServer Faces Cardemo Example (Click to enlarge)
For the rest: http://www.9cbs.net/develop/read_article.asp?id=18705 Develop web applications with JavaServer Faces (1) http://www.9cbs.net/develop/read_article.asp?id = 18709 Develop web applications with JavaServer Faces (3)
Http://www.9cbs.net/develop/read_article.asp?id=18710 Develop web applications with JavaServer Faces (4)
Http://www.9cbs.net/develop/read_article.asp?id=18712 Develop web applications with JavaServer Faces (5)