Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
3Activity
0 of .
Results for:
No results containing your search query
P. 1
jsf kickstart

jsf kickstart

Ratings: (0)|Views: 53|Likes:
Published by ravi.rocky1020

More info:

Published by: ravi.rocky1020 on Sep 23, 2010
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

05/24/2012

pdf

text

original

 
JavaServer Faces(JSF) TutorialJSF KickStart: A Simple JavaServer FacesApplication
In this tutorial, we will show you an example of a JSF application developed without any specialIDE. We won't dwell on the theory behind JSF here. There are plenty of sites and books that willdo that for you. Instead, we will go quickly into the construction of this simple application that wehope can form the basis for you to start developing more advanced applications.
What Is JavaServer Faces?
Per our promise, we will keep the background simple. JavaServer Faces is a new framework for building Web applications using Java. JavaServer Faces provides you with the following mainfeatures:
Page navigation specification
Standard user interface components like input fields, buttons, and links
User input validation
Easy error handling
Java bean management
Event handling
Internationalization supportJSF provides the common plumbing for any Web application allowing you to concentrate on your specific application (instead of worrying about things like how to create a link from one page toanother). This will become clearer as we go along.
What Will You Need?
You will need the following to complete this tutorial:
JDK 1.4
Tomcat 5.0 or any other servlet container (JBoss, Resin, JRun). We will use Tomcat inthis example.
AntWe will provide you with many of the project files so that you don't need to create them yourself.We will be concentrating primarily on the actual JSF application, not on creating Ant scripts or web.xml files. These files will be provided for you. You will just need to copy and paste contentfrom this tutorial.
What Are We Going to Build?
You may have guessed by now. We are going to build a "Hello, world" (actually "Welcome to JSF,<user>!") type application using JSF. This should give you a solid start with JSF.
 
We will create two pages. The first page will prompt a user to enter his or her name and thesecond page will show a greeting. This is a sample of the input page:and this is a sample of the result page:
JSF Application Structure
We have provided you with a pre-made project structure skeleton in an archivecalled
 jsfks.zip
that you can download and unzip. After unzipping you should have the following structure:
jsfks/antbuild.xml/JavaSource/WebContent/WEB-INF/classes/libjsf-impl.jarjsf-api.jarfaces-config.xml
 
web.xml/pages
This is a typical skeleton structure for a Web application like JSF. Now, let's go through thedifferent parts of the skeleton structure.
folder or file explanation
 jsfksProject folder with project name/antThis folder holds Ant build scripts including a default
build.xml
file./JavaSourceThis folder is where you place your own Java source classes and properties files./WebContentThis folder holds the actual Web application files used by the applicationserver or servlet container./WEB-INFThis folder inside the
WebContent
folder holds files that are used as partof the runtime Web application but are hidden from the browser./classesThis folder inside the
WEB-INF
folder holds compiled Java classesalong with properties files copied from
JavaSource
./libThis folder inside the
WEB-INF
folder holds libraries required by your application, for example, third party Jar files.jsf-impl.jar jsf-api.jar These two files inside the
lib
folder are library files included with theJavaServer Faces v1.1 Reference Implementation. Every JSF applicationrequires these files.web.xmlThis file inside the
WEB-INF
folder is the Web Application DeploymentDescriptor for your application. This is an XML file describing theservlets and other components that make up your application.faces-config.xmlThis file inside the
WEB-INF
folder is the JavaServer Facesconfiguration file. This file lists bean resources and navigation rules. Wewill cover this file in more detail later.pagesThis folder inside the
WebContent
folder holds JSP and HTML presentation pages.
We have already provided you with two complete project files in the theproject,
web.xml
and
build.xml
, so that you don't have to spend time creating these. (Thistutorial is not about creating these kinds of files.)
The Steps
We will complete the following steps:1.Create JSP pages2.Define a navigation rule3.Create a managed bean4.Create a properties file

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->