Home arrow Java & J2EE arrow Page 5 - Introduction to JavaServer Faces Part 2

And the Message - Java

We continue with part two of Chapter 2 of Introduction JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983-7, 2004). This section deals with the ActionListener and Component Tree, as well as validation and navigation for your JSP pages.  This chapter prepares you for the next chapters by introducing the JSF Application Programming Interface (API) and the Application Configuration file.

  1. Introduction to JavaServer Faces Part 2
  2. The Action Listener
  3. Continuing With the navigateComponent Tree
  4. Console Message
  5. And the Message
  6. Authoring the JSP Page for the Validator Example
By: McGraw-Hill/Osborne
Rating: starstarstarstarstar / 23
March 15, 2004

print this article



More informative is the message that is displayed in the console:

getFirstNumber: 0
getSecondNumber: 0
processAction called
The id of the component that fired the action event: submitButton
Action command: submit
----------- Component Tree -------------
setFirstNumber: 10
setSecondNumber: 20
getFirstNumber: 10
getSecondNumber: 20
getResult: 30

Creating the Validator Example

The example presented in this section demonstrates how you can validate user input very easily in JSF. This application is even simpler than the one presented in the previous section. It consists of only one JSP page, and it does not require a JavaBean or an application configuration file. However, you will still need a directory structure for the application and the deployment descriptor. The deployment descriptor is the same as the one in Listing 1. Here, we will look at the directory structure and JSP page.

Creating the Directory Structure for the Validator Example

The directory structure for your application, called JSFCh02b, is depicted in Figure 8. In Tomcat, you create this under webapps. The directory contains all the required components that you will build in this example.

Again, you must copy the .jar files containing the JSF implementation into the WEB-INF/lib directory. Then, in the application directory, you have the validatorTest.jsp page.

Buy this book now!Remember: This is part one of the second chapter of JavaServer Faces Programming, by Budi Kurniawan (McGraw-Hill/Osborne, ISBN 0-07-222983). Stay tuned for more helpful chapters from McGraw-Hill/Osborne.
Buy this book!

>>> More Java & J2EE Articles          >>> More By McGraw-Hill/Osborne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- More Java Bugs Lead to More Attacks
- Oracle's Java One Brings News, Surprises
- Oracle Patches Java Runtime Environment
- Apple Syncs Java Update with Oracle
- Spring 3.1 Java Development Framework Compat...
- Jelastic Java PaaS Availability and Pricing ...
- NetBeans 7.1 Released, Supports JavaFX 2
- SolarWinds Releases Newest Version of Java M...
- Free Monitoring Tool for Java Apps on Heroku
- Heroku Adds JCloud Platform Support, Java 7 ...
- Java SE 8 Speculation in Full Swing
- Java SE 7 Now Available
- New JVM Language and Java Reporting Tool
- Java 7 Release Update and New Eclipse Toolkit
- The Best Java Netbeans IDE Plugins

Developer Shed Affiliates


Dev Shed Tutorial Topics: