Java
  Home arrow Java arrow Page 9 - Introduction to JavaServer Faces, Part...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Introduction to JavaServer Faces, Part 1
By: McGraw-Hill/Osborne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 52
    2004-03-08

    Table of Contents:
  • Introduction to JavaServer Faces, Part 1
  • Understanding the Request Processing Lifecycle Phases
  • Using an Application Configuration File
  • Writing a JSF Application
  • Writing JavaBeans and Event Listeners
  • Creating the Event Listener and Component Tree Example
  • Creating the Directory Structure
  • Writing the Object Model for the Listener and Component Tree Example
  • Defining Taglib Directives

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    IBM developerWorks
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Introduction to JavaServer Faces, Part 1 - Defining Taglib Directives


    (Page 9 of 9 )

    First, you define two taglib directives to use the two JSF tag libraries: HTML and Core. The tag library descriptors for these two libraries can be found in the jsf-ri.jar file, so you do not need to worry about them. The prefix for the HTML tag library is h, and the prefix for the Core tag library is f.


    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %><%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>Next are the JSF controls. Note that JSF controls must be enclosed in the opening and closing elements:


    <f:use_faces>
    ...
    </f:use_faces>


    Inside these elements, you have a form:


    </f:use_faces><f:use_faces> <h:form formName=''addForm">
    <h:form formName="
    addForm">...
    </h:form>

    Nested inside the form are two input_number controls, an output_number control, and a command_button control.


    <br/>First Number:
    <h:input_number id="firstNumber"
      valueRef
    ="numberBean.firstNumber"/>
    <br/>Second Number:
    <h:input_number id="secondNumber"
      valueRef
    ="numberBean.secondNumber"/>
    <br/>Result:
    <h:output_number id="output" valueRef="NumberBean.result"/>
    <br/>
    <h:command_button id="submitButton" label="Add"
      commandName
    ="submit" >
    <f:action_listener type="ch02a.MyActionListener" />
    </h:command_button>

    Notice the ActionListener for the command button.

    The component tree

    Figure 5
    The component tree of the adder.jsp page

    Conceptually, the component tree for this JSP page is depicted in Figure 5, with the root omitted. The main component is the form, and the form has four child components.

    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 part 2 of "Introduction to JavaServer Faces," where we learn about JSP, JavaBeans, and Model 2. 
    Buy this book!

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

       

    JAVA ARTICLES

    - Adding Images With iTextSharp
    - Adding Columns With iTextSharp
    - Creating Simple PDF Files With iTextSharp
    - The Spring Framework: Understanding IoC
    - Introducing the Spring Framework
    - Java Classes
    - Completing the Syntactic Comparison of Java ...
    - Syntactic Comparison of Java and C/C++
    - Java Statements
    - Conditionals, Expressions and Other Java Ope...
    - Java Operators
    - Primitive Data Types and Basic Language Rule...
    - Java and Object-Oriented Programming
    - Java Beginning Programming
    - Gaming Development Setup





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway