Magazine
 
Develop-JSF Application
 

This section is very useful for any beginner in the field of JSF (Java Server Faces) framework of Java. This example covers all you need to develop the application, for example, using JSF tags, creating properties files and managed beans, modifying configuration files like facesconfig. xml and web.xml, directory structure of the application etc. Detailed explanation of this example will definitely support you to develop JSF applications with rich set of functionality of JSF.

In this application, the first page that the user experiences is displayed with an input text box and a command button component. User enters name in the box and presses the button then user is welcomed in the next page.

Steps Followed:

We will follow the steps below to create this application:

1 Create development directory structure (root directory and sub directories)

2 Create and place configuration files in appropriate place

3 Create JSP pages

4 Create a properties file

5 Create a managed bean

6 Register managed bean in configuration
file

7 Define a navigation rule in configuration
file

8 Run the application

To understand clearly where to place which file, directory structure of this application will help you a lot. So have a look on it below:

Directory structure of this application:

The pictorial directory structure given below is very useful to understand the application. This structure shows where to put which file or directory.

 

Create and place directories, configuration files:

We used JDK 1.6.0 and TOMCAT 5.5.23 to deploy and run this application. So you are expected to install and configure TOMCAT for JSF.

Directories:
In tomcat, web applications are placed within webapps folder. Now we are going to start creating “JSFHelloApplication” application so the first step is to create a folder in web apps with the name “JSFHelloApplication”. This is the root directory of the application. Now create WEBINF folder in root directory and place configuration files web.xml and faces-config.xml file.

Configuration files:

1. web.xml: You can get web.xml file from WEB-INF folder of any other application available in TOMCAT by default or you can create yourself with the same name and extention of the file i.e. “web.xml”. If you are creating this file then take care of mentioning version of xml. For ex.<?xml version=”1.0"?> at the top of file and after that all elements will be written within

Oct 2007 | Java Jazz Up | 55
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78,   Download PDF