News »Browse Articles »
Java EE 5.0 Development with NetBeans 6.0 (Developing Web Applications using JSF)
0
Java EE 5.0 Development with NetBeans 6.0 (Developing Web Applications using JSF)
Introduction to JavaServer Faces
The following topics will be covered in this chapter:
* Creating a JSF project with NetBeans
* Generating a form to capture user data by draging a JSF form from the NetBeans palette into our page
* Laying out JSF tags by taking advantage of the JSF tag
* Using static and dynamic navigation to defi ne navigation between pages
* Using the NetBeans New JSF Managed Bean wizard to create a JSF managed bean and automatically add it to the application`s confi guration file
* Using the NetBeans Page Flow editor to establish page navigation by graphically connecting pages
* Implementing custom JSF validators
* Displaying tabular data in our pages by dragging-and-dropping the JSF Data Table item from the NetBeans palette into our page
Before JSF was developed, Java web applications were typically developed using non-standard web application frameworks such as Apache Struts, Tapestry, Spring Web MVC, or many others. These frameworks are built on top of the Servlet and JSP standards, and automate a lot of functionality that needs to be manually coded when using these APIs directly.
Having a wide variety of web application frameworks available (at the time of writing, Wikipedia lists 35 Java web application frameworks, and this list is far from extensive!), often resulted in "analysis paralysis", that is, developers often spend an inordinate amount of time evaluating frameworks for their applications.
The introduction of JSF to the Java EE 5 specifi cation resulted in having a standard web application framework available in any Java EE 5 compliant application server.
We don`t mean to imply that other web application frameworks are obsolete or that they shouldn`t be used at all, however, a lot of organizations consider JSF the "safe" choice since it is part of the standard and should be well supported for the foreseeable future. Additionally, NetBeans offers excellent JSF support, making JSF a very attractive choice.
Strictly speaking, JSF is not a web application framework as such, but a component framework. In theory, JSF can be used to write applications that are not web-based, however, in practice JSF is almost always used for this purpose.
In addition to being the standard Java EE 5 component framework, one benefi t of JSF is that it was designed with graphical tools in mind, making it easy for tools and IDEs such as NetBeans to take advantage of the JSF component model with drag-and-drop support for components. NetBeans provides a Visual Web JSF Designer that allow us to visually create JSF applications. This tool is discussed in detail in Chapter 6.
Developing Our first JSF Application
From an application developer`s point of view, a JSF application consists of a series of JSP pages containing custom JSF tags, one or more JSF managed beans, and a confi guration fi le named faces-config.xml. The faces-config.xml fi le declares the managed beans in the application, as well as the navigation rules to follow when navigating from one JSF page to another.
Creating a New JSF Project
To create a new JSF project, we need to go to File | New Project, select the Java Web project category, and Web Application as the project type.
After clicking Next>, we need to enter a Project Name, and optionally change other information for our project, although NetBeans provides sensible defaults.
Source:
http://www.javabeat.net/articles/89-java-ee-50-development-with-netbeans-60-deve
The following topics will be covered in this chapter:
* Creating a JSF project with NetBeans
* Generating a form to capture user data by draging a JSF form from the NetBeans palette into our page
* Laying out JSF tags by taking advantage of the JSF tag
* Using static and dynamic navigation to defi ne navigation between pages
* Using the NetBeans New JSF Managed Bean wizard to create a JSF managed bean and automatically add it to the application`s confi guration file
* Using the NetBeans Page Flow editor to establish page navigation by graphically connecting pages
* Implementing custom JSF validators
* Displaying tabular data in our pages by dragging-and-dropping the JSF Data Table item from the NetBeans palette into our page
Before JSF was developed, Java web applications were typically developed using non-standard web application frameworks such as Apache Struts, Tapestry, Spring Web MVC, or many others. These frameworks are built on top of the Servlet and JSP standards, and automate a lot of functionality that needs to be manually coded when using these APIs directly.
Having a wide variety of web application frameworks available (at the time of writing, Wikipedia lists 35 Java web application frameworks, and this list is far from extensive!), often resulted in "analysis paralysis", that is, developers often spend an inordinate amount of time evaluating frameworks for their applications.
The introduction of JSF to the Java EE 5 specifi cation resulted in having a standard web application framework available in any Java EE 5 compliant application server.
We don`t mean to imply that other web application frameworks are obsolete or that they shouldn`t be used at all, however, a lot of organizations consider JSF the "safe" choice since it is part of the standard and should be well supported for the foreseeable future. Additionally, NetBeans offers excellent JSF support, making JSF a very attractive choice.
Strictly speaking, JSF is not a web application framework as such, but a component framework. In theory, JSF can be used to write applications that are not web-based, however, in practice JSF is almost always used for this purpose.
In addition to being the standard Java EE 5 component framework, one benefi t of JSF is that it was designed with graphical tools in mind, making it easy for tools and IDEs such as NetBeans to take advantage of the JSF component model with drag-and-drop support for components. NetBeans provides a Visual Web JSF Designer that allow us to visually create JSF applications. This tool is discussed in detail in Chapter 6.
Developing Our first JSF Application
From an application developer`s point of view, a JSF application consists of a series of JSP pages containing custom JSF tags, one or more JSF managed beans, and a confi guration fi le named faces-config.xml. The faces-config.xml fi le declares the managed beans in the application, as well as the navigation rules to follow when navigating from one JSF page to another.
Creating a New JSF Project
To create a new JSF project, we need to go to File | New Project, select the Java Web project category, and Web Application as the project type.
After clicking Next>, we need to enter a Project Name, and optionally change other information for our project, although NetBeans provides sensible defaults.
Source:
http://www.javabeat.net/articles/89-java-ee-50-development-with-netbeans-60-deve
Search News
News Categories
What's the News?
Post a link to something interesting from another site, or submit your own original writing for the Java community to read.
Most Popular News
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- Why Java Doesn`t Need Operator Overloading
Published about 14-04-2009 | Rated 0 - How IT Cos can fight slowdown
Submitted by Sonal | Rated +1 - Can a abstract class be declared final?
Submitted by Balamurali | Rated 0 - mock on Threads
Submitted by ATUL | Rated +2







