HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"JavaServer Faces"
Vol. 8, Issue 5, p. 16

	



Listing 1

    <component>
        <type>javax.faces.component.UISelectBoolean</type>
        <renderer>
            <type>CheckboxRenderer</type>
            <class>com.sun.faces.renderkit.jamiels_kit.HTMLCheckboxRenderer</class>
            <attribute>
                <name>none</name>
                <display-name>none</display-name>
                <description>none</description>
                <type>java.lang.String</type>
            </attribute>
        </renderer>
    </component>

Listing 2

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   <listener>
      <listener-class>
         com.weather.listeners.WeatherContextListener
      </listener-class>
   </listener>
   <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>

   <!-- Faces Servlet Mapping -->
   <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
   </servlet-mapping>

   <welcome-file-list>
      <welcome-file>welcome.jsp</welcome-file>
   </welcome-file-list>
</web-app>

Listing 3

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
   <head>
      <title>JSF Weather Application</title>
   </head>
   <body>
      <%@ taglib uri="http://java.sun.com/j2ee/html_basic/" prefix="faces" %>

      <font size="8">Please enter your zip-code</font>
      
      <faces:usefaces>
         <faces:form id="weatherForm" formName="weatherForm">
            <table>
               <tr>
                  <td>Name:</td>
                  <td>
                     <faces:textentry_input id='zip'>
                        <faces:validator
                          className='javax.faces.validator.LengthValidator'/>
                           <faces:attributename=
                             'javax.faces.validator.LengthValidator.MINIMUM'
                              value='5'/>
                      </faces:textentry_input>
                  </td>
                  <td>
                     <faces:validation_message componentId='zip'/>
                  </td>
               </tr>
               <tr>
                  <td>City:</td>
                  <td>
                     <faces:textentry_input id='city'/>
                  </td>
               </tr>
               <tr>
                  <td>State:</td>
                  <td>
                     <faces:textentry_input id='state'> 
                        <faces:validator
                          className='javax.faces.validator.LengthValidator'/>
                           <faces:attributename=
                             'javax.faces.validator.LengthValidator.MINIMUM'
                              value='2'/>
                      </faces:textentry_input>
                  </td>
                  <td>
                     <faces:validation_message componentId='state'/>
                  </td>
               </tr>
            </table>
            <p><faces:command_button id="submit" commandName="Check Weather"/>
         </faces:form>
      </faces:usefaces>
   </body>
</html>


 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.