[corejsf~subversion:174] cleaned up ch10

  • From: cayhorstmann@kenai.com
  • To: commits@corejsf.kenai.com
  • Subject: [corejsf~subversion:174] cleaned up ch10
  • Date: Fri, 12 Feb 2010 03:09:06 +0000

Project:    corejsf
Repository: subversion
Revision:   174
Author:     cayhorstmann
Date:       2010-02-12 03:09:01 UTC
Link:       

Log Message:
------------
cleaned up ch10


Revisions:
----------
174


Modified Paths:
---------------
ch10/echo
ch10/autoComplete
ch10/autoComplete/src/java/com/corejsf/AutoComplete.java
ch10/validation
ch10/autoComplete/web/WEB-INF/sun-web.xml
ch10/requestMonitor/web/WEB-INF/sun-web.xml
ch10/validation/web/welcome.xhtml
ch10/echo/web/WEB-INF/web.xml
ch10/echo/web/welcome.xhtml
ch10/validation/src/java/com/corejsf/UserBean.java
ch10/requestMonitor/src/java/com/corejsf/UserBean.java
ch10/validation/web/WEB-INF/web.xml
ch10/requestMonitor/web/welcome.xhtml
ch10/requestMonitor/web/resources/javascript/login.js
ch10/echo/web/WEB-INF/sun-web.xml
ch10/requestMonitor
ch10/requestMonitor/web/WEB-INF/web.xml
ch10/requestMonitor/web/WEB-INF/faces-config.xml
ch10/autoComplete/web/WEB-INF/web.xml
ch10/autoComplete/src/java/com/corejsf/AutocompleteListener.java
ch10/validation/web/WEB-INF/sun-web.xml


Added Paths:
------------
ch10/autoComplete/web/index.xhtml
ch10/requestMonitor/web/index.xhtml
ch10/echo/web/index.xhtml
ch10/validation/web/index.xhtml


Diffs:
------
Index: ch10/requestMonitor/src/java/com/corejsf/UserBean.java
===================================================================
--- ch10/requestMonitor/src/java/com/corejsf/UserBean.java      (revision 173)
+++ ch10/requestMonitor/src/java/com/corejsf/UserBean.java      (revision 174)
@@ -23,15 +23,14 @@
    public void setPassword(String newValue) { password = newValue; }
    
    public void validateName(FacesContext fc, UIComponent c, Object value) {
-         try {
-               Thread.sleep(200);
-         } catch (InterruptedException e) {
-                e.printStackTrace();
-         }
+          try {
+                  Thread.sleep(200);
+          } catch (InterruptedException e) {
+                  e.printStackTrace();
+          }
        
-         if ( ((String)value).contains("_") )
-            throw new ValidatorException(
-               new FacesMessage("Name cannot contain underscores"));
-         
+          if (((String) value).contains("_"))
+             throw new ValidatorException(
+                new FacesMessage("Name cannot contain underscores"));
    }
 }
\ No newline at end of file
Index: ch10/requestMonitor/web/login.xhtml
===================================================================
--- ch10/requestMonitor/web/login.xhtml (revision 173)
+++ ch10/requestMonitor/web/login.xhtml (revision 174)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
-   <h:head>
-      <title>#{msgs.loginWindowTitle}</title>
-   </h:head>
-   
-   <h:body style="background: #fefeef">
-      <h:outputScript library="javascript" name="prototype-1.6.0.2.js"/>   
-      <h:outputScript library="javascript" name="login.js"/>
-      <h:form>
-         <h3>#{msgs.loginHeading}</h3>
-         <h:panelGrid columns="2">
-
-            #{msgs.namePrompt}
-            <h:panelGroup>
-                   <h:inputText value="#{user.name}" id="name"
-                      validator="#{user.validateName}">
-                      <f:ajax event="keyup" render="nameError" 
-                         onevent="com.corejsf.showProgress"/>
-                   </h:inputText>
-                   
-                   <h:message id="nameError" for="name" style="color: red"/>
-                   
-                   <h:graphicImage id="pole" library="images" 
-                     name="orange-barber-pole.gif"
-                     style="display: none"/>
-            </h:panelGroup>
-            
-            #{msgs.passwordPrompt}
-            <h:inputSecret value="#{user.password}" id="password"
-              size="8"/>
-              
-            <h:commandButton value="#{msgs.loginButtonText}"
-               action="welcome"/>            
-         </h:panelGrid>
-      </h:form>
-   </h:body>
-</html>
\ No newline at end of file
Index: ch10/requestMonitor/web/index.xhtml
===================================================================
--- ch10/requestMonitor/web/index.xhtml (revision 0)
+++ ch10/requestMonitor/web/index.xhtml (revision 174)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:h="http://java.sun.com/jsf/html";
+      xmlns:f="http://java.sun.com/jsf/core";>
+   <h:head>
+      <title>#{msgs.loginWindowTitle}</title>
+   </h:head>
+   
+   <h:body style="background: #fefeef">
+      <h:outputScript library="javascript" name="prototype-1.6.0.2.js"/>   
+      <h:outputScript library="javascript" name="login.js"/>
+      <h:form>
+         <h3>#{msgs.loginHeading}</h3>
+         <h:panelGrid columns="2">
+
+            #{msgs.namePrompt}
+            <h:panelGroup>
+                   <h:inputText value="#{user.name}" id="name"
+                      validator="#{user.validateName}">
+                      <f:ajax event="keyup" render="nameError" 
+                         onevent="com.corejsf.showProgress"/>
+                   </h:inputText>
+                   
+                   <h:message id="nameError" for="name" style="color: red"/>
+                   
+                   <h:graphicImage id="pole" library="images" 
+                     name="orange-barber-pole.gif"
+                     style="display: none"/>
+            </h:panelGroup>
+            
+            #{msgs.passwordPrompt}
+            <h:inputSecret value="#{user.password}" id="password" size="8"/>
+              
+            <h:commandButton value="#{msgs.loginButtonText}" 
action="welcome"/>            
+         </h:panelGrid>
+      </h:form>
+   </h:body>
+</html>
\ No newline at end of file
Index: ch10/requestMonitor/web/welcome.xhtml
===================================================================
--- ch10/requestMonitor/web/welcome.xhtml       (revision 173)
+++ ch10/requestMonitor/web/welcome.xhtml       (revision 174)
@@ -2,8 +2,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
+      xmlns:h="http://java.sun.com/jsf/html";>
    <h:head>
       <title>#{msgs.loginWindowTitle}</title>
    </h:head>
Index: ch10/requestMonitor/web/WEB-INF/sun-web.xml
===================================================================
--- ch10/requestMonitor/web/WEB-INF/sun-web.xml (revision 173)
+++ ch10/requestMonitor/web/WEB-INF/sun-web.xml (revision 174)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application 
Server 9.0 Servlet 2.5//EN" 
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd";>
 <sun-web-app error-url="">
-  <context-root>/login_ajax</context-root>
+  <context-root>requestMonitor</context-root>
   <class-loader delegate="true"/>
   <jsp-config>
     <property name="keepgenerated" value="true">
Index: ch10/requestMonitor/web/WEB-INF/faces-config.xml
===================================================================
--- ch10/requestMonitor/web/WEB-INF/faces-config.xml    (revision 173)
+++ ch10/requestMonitor/web/WEB-INF/faces-config.xml    (revision 174)
@@ -3,11 +3,10 @@
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ;
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd";
               version="2.0">
-  <application>
-    <resource-bundle>
-      <base-name>com.corejsf.messages</base-name>
-      <var>msgs</var>
-    </resource-bundle>
-    
-  </application>              
+   <application>
+      <resource-bundle>
+         <base-name>com.corejsf.messages</base-name>
+         <var>msgs</var>
+      </resource-bundle>
+   </application>
 </faces-config>
\ No newline at end of file
Index: ch10/requestMonitor/web/WEB-INF/web.xml
===================================================================
--- ch10/requestMonitor/web/WEB-INF/web.xml     (revision 173)
+++ ch10/requestMonitor/web/WEB-INF/web.xml     (revision 174)
@@ -14,7 +14,7 @@
       <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
-      <welcome-file>faces/login.xhtml</welcome-file>
+      <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
       <param-name>javax.faces.PROJECT_STAGE</param-name>
Index: ch10/requestMonitor/web/resources/javascript/login.js
===================================================================
--- ch10/requestMonitor/web/resources/javascript/login.js       (revision 173)
+++ ch10/requestMonitor/web/resources/javascript/login.js       (revision 174)
@@ -1,15 +1,15 @@
-if ( ! com) var com = {}
+if (!com) var com = {}
 if (!com.corejsf) {
-  com.corejsf = {   
-       showProgress: function(data) { 
-         var inputId = data.source.id
-         var progressbarId = inputId.substring(0, inputId.length - 
"name".length)
-        + "pole";
+   com.corejsf = {
+          showProgress: function(data) {
+          var inputId = data.source.id
+             var progressbarId = inputId.substring(0, inputId.length - 
"name".length)
+            + "pole";
        
-      if (data.status == "begin")      
-        Element.show(progressbarId);
-      else if (data.status == "success")
-        Element.hide(progressbarId);
-    }
-  }
+         if (data.status == "begin")
+            Element.show(progressbarId);
+         else if (data.status == "success")
+            Element.hide(progressbarId);
+      }
+   }
 }
\ No newline at end of file

Property changes on: ch10/requestMonitor
___________________________________________________________________
Added: svn:ignore
   + build


Index: ch10/autoComplete/src/java/com/corejsf/AutoComplete.java
===================================================================
--- ch10/autoComplete/src/java/com/corejsf/AutoComplete.java    (revision 173)
+++ ch10/autoComplete/src/java/com/corejsf/AutoComplete.java    (revision 174)
@@ -1,13 +1,19 @@
 package com.corejsf;
 
-import javax.faces.bean.ApplicationScoped;
-import javax.inject.Named; 
+import javax.inject.Named;
+   // or import javax.faces.bean.ManagedBean;
+import javax.enterprise.context.ApplicationScoped;
+   // or import javax.faces.bean.ApplicationScoped;
 
-@Named() //@ManagedBean()
-@ApplicationScoped()
+@Named //@ManagedBean
+@ApplicationScoped
 public class AutoComplete {
-  public String[] getLocations() { 
-    return new String[] { "Arvada", "Colorado Springs", "Baltimore", 
"Brittany", "Bahamas", "Belgrade", "Boulder", "Bayou", "Brighton", "Buffalo", 
"Denver", "Dixie", 
-        "Evergreen", "Ft. Collins", "Los Angeles", "Los Lobos", "Las Vegas", 
"Loveland", "Vail" };
-  }
+   public String[] getLocations() {
+      return new String[] {
+          "Arvada", "Colorado Springs", "Baltimore", "Brittany", "Bahamas",
+          "Belgrade", "Boulder", "Bayou", "Brighton", "Buffalo", "Denver", 
"Dixie",
+          "Evergreen", "Ft. Collins", "Los Angeles", "Los Lobos", "Las 
Vegas",
+          "Loveland", "Vail"
+      };
+   }
 }
\ No newline at end of file
Index: ch10/autoComplete/src/java/com/corejsf/AutocompleteListener.java
===================================================================
--- ch10/autoComplete/src/java/com/corejsf/AutocompleteListener.java    
(revision 173)
+++ ch10/autoComplete/src/java/com/corejsf/AutocompleteListener.java    
(revision 174)
@@ -4,78 +4,80 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.SessionScoped;
+import javax.inject.Named;
+   // or import javax.faces.bean.ManagedBean;
+import javax.enterprise.context.SessionScoped;
+   // or import javax.faces.bean.SessionScoped;
 import javax.faces.component.UIInput;
 import javax.faces.component.UISelectItems;
 import javax.faces.component.UISelectOne;
 import javax.faces.context.FacesContext;
 import javax.faces.event.ValueChangeEvent;
-import javax.inject.Named; 
 
-@Named() //@ManagedBean()
-@SessionScoped()
+
+@Named // @ManagedBean
+@SessionScoped
 public class AutocompleteListener {
-  private static String COMPLETION_ITEMS_ATTR = "corejsf.completionItems";
+   private static String COMPLETION_ITEMS_ATTR = "corejsf.completionItems";
   
-  public void valueChanged(ValueChangeEvent e) {
-    UIInput input = (UIInput)e.getSource();
-    UISelectOne listbox = (UISelectOne)input.findComponent("listbox");
+   public void valueChanged(ValueChangeEvent e) {
+      UIInput input = (UIInput)e.getSource();
+      UISelectOne listbox = (UISelectOne)input.findComponent("listbox");
 
-    if (listbox != null) {
-      UISelectItems items = (UISelectItems)listbox.getChildren().get(0);
-      Map<String, Object> attrs = listbox.getAttributes();
-      List<String> newItems = getNewItems((String)input.getValue(), 
-          getCompletionItems(listbox, items, attrs));
+      if (listbox != null) {
+         UISelectItems items = (UISelectItems)listbox.getChildren().get(0);
+         Map<String, Object> attrs = listbox.getAttributes();
+         List<String> newItems = getNewItems((String)input.getValue(),
+            getCompletionItems(listbox, items, attrs));
 
-      items.setValue(newItems.toArray());
-      setListboxStyle(newItems.size(), attrs);
-    } 
-  }
+         items.setValue(newItems.toArray());
+         setListboxStyle(newItems.size(), attrs);
+      }
+   }
    
-  private List<String> getNewItems(String inputValue, String[] 
completionItems) {
-    List<String> newItems = new ArrayList<String>();
+   private List<String> getNewItems(String inputValue, String[] 
completionItems) {
+      List<String> newItems = new ArrayList<String>();
     
-    for (String item : completionItems) {
-      String s = item.substring(0, inputValue.length());
-      if (s.equalsIgnoreCase(inputValue))
-        newItems.add(item);
-    } 
+      for (String item : completionItems) {
+         String s = item.substring(0, inputValue.length());
+         if (s.equalsIgnoreCase(inputValue))
+           newItems.add(item);
+      }
     
-    return newItems;
-  }
+      return newItems;
+   }
   
-  private void setListboxStyle(int rows, Map<String, Object> attrs) {
-    if (rows > 0) {
-      Map<String, String> reqParams = FacesContext.getCurrentInstance()
-      .getExternalContext().getRequestParameterMap();
+   private void setListboxStyle(int rows, Map<String, Object> attrs) {
+      if (rows > 0) {
+         Map<String, String> reqParams = FacesContext.getCurrentInstance()
+            .getExternalContext().getRequestParameterMap();
       
-      attrs.put("style", "display: inline; position: absolute; left: " 
-          + reqParams.get("x") + "px;" + " top: " + reqParams.get("y") + 
"px");
-    }
-    else
-      attrs.put("style", "display: none;");
-  }
+         attrs.put("style", "display: inline; position: absolute; left: "
+             + reqParams.get("x") + "px;" + " top: " + reqParams.get("y") + 
"px");
+      }
+      else
+         attrs.put("style", "display: none;");
+   }
 
-  private String[] getCompletionItems(UISelectOne listbox, 
+   private String[] getCompletionItems(UISelectOne listbox,
       UISelectItems items, Map<String, Object> attrs) {
-    String[] completionItems = (String[])attrs.get(COMPLETION_ITEMS_ATTR);
+         String[] completionItems = 
(String[])attrs.get(COMPLETION_ITEMS_ATTR);
     
-    if (completionItems == null) {
-      completionItems = (String[])items.getValue();
-      attrs.put(COMPLETION_ITEMS_ATTR, completionItems);      
-    }
-    return completionItems;
-  }
+         if (completionItems == null) {
+            completionItems = (String[])items.getValue();
+            attrs.put(COMPLETION_ITEMS_ATTR, completionItems);
+         }
+      return completionItems;
+   }
   
-  public void completionItemSelected(ValueChangeEvent e) {
-    UISelectOne listbox = (UISelectOne)e.getSource();
-    UIInput input = (UIInput)listbox.findComponent("input");
+   public void completionItemSelected(ValueChangeEvent e) {
+     UISelectOne listbox = (UISelectOne)e.getSource();
+     UIInput input = (UIInput)listbox.findComponent("input");
     
-    if(input != null) {
-      input.setValue(listbox.getValue());
-    }
-    Map<String, Object> attrs = listbox.getAttributes();
-    attrs.put("style", "display: none");    
-  }
+     if(input != null) {
+        input.setValue(listbox.getValue());
+     }
+     Map<String, Object> attrs = listbox.getAttributes();
+     attrs.put("style", "display: none");
+   }
 }
\ No newline at end of file
Index: ch10/autoComplete/web/autoComplete.xhtml
===================================================================
--- ch10/autoComplete/web/autoComplete.xhtml    (revision 173)
+++ ch10/autoComplete/web/autoComplete.xhtml    (revision 174)
@@ -1,27 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-
-<html xmlns="http://www.w3.org/1999/xhtml";
-    xmlns:f="http://java.sun.com/jsf/core";
-    xmlns:h="http://java.sun.com/jsf/html"    ;
-   xmlns:util="http://java.sun.com/jsf/composite/util";>
-
-  <h:head>
-     <title>#{msgs.autoCompleteWindowTitle}</title>
-  </h:head>
-  
-  <h:body background="#fefeef">
-    <div style="padding: 20px;">
-           <h:form>
-             <h:panelGrid columns="2">
-             
-               #{msgs.locationsPrompt}
-               
-               <util:autoComplete value="#{user.name}"
-                 completionItems="#{autoComplete.locations}" /> 
-       
-             </h:panelGrid> 
-           </h:form>
-    </div>
-  </h:body>
-</html> 
\ No newline at end of file
Index: ch10/autoComplete/web/index.xhtml
===================================================================
--- ch10/autoComplete/web/index.xhtml   (revision 0)
+++ ch10/autoComplete/web/index.xhtml   (revision 174)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:h="http://java.sun.com/jsf/html";
+      xmlns:util="http://java.sun.com/jsf/composite/util";>
+   <h:head>
+      <title>#{msgs.autoCompleteWindowTitle}</title>
+   </h:head>
+
+   <h:body>
+      <div style="padding: 20px;">
+         <h:form>
+            <h:panelGrid columns="2">
+               #{msgs.locationsPrompt}
+               <util:autoComplete value="#{user.name}"
+                     completionItems="#{autoComplete.locations}" />
+            </h:panelGrid>
+         </h:form>
+      </div>
+   </h:body>
+</html> 
\ No newline at end of file
Index: ch10/autoComplete/web/WEB-INF/sun-web.xml
===================================================================
--- ch10/autoComplete/web/WEB-INF/sun-web.xml   (revision 173)
+++ ch10/autoComplete/web/WEB-INF/sun-web.xml   (revision 174)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application 
Server 9.0 Servlet 2.5//EN" 
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd";>
 <sun-web-app error-url="">
-  <context-root>/login_ajax</context-root>
+  <context-root>/autoComplete</context-root>
   <class-loader delegate="true"/>
   <jsp-config>
     <property name="keepgenerated" value="true">
Index: ch10/autoComplete/web/WEB-INF/web.xml
===================================================================
--- ch10/autoComplete/web/WEB-INF/web.xml       (revision 173)
+++ ch10/autoComplete/web/WEB-INF/web.xml       (revision 174)
@@ -14,7 +14,7 @@
       <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
-      <welcome-file>faces/autoComplete.xhtml</welcome-file>
+      <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
       <param-name>javax.faces.PROJECT_STAGE</param-name>

Property changes on: ch10/autoComplete
___________________________________________________________________
Added: svn:ignore
   + build


Index: ch10/validation/src/java/com/corejsf/UserBean.java
===================================================================
--- ch10/validation/src/java/com/corejsf/UserBean.java  (revision 173)
+++ ch10/validation/src/java/com/corejsf/UserBean.java  (revision 174)
@@ -2,12 +2,13 @@
 
 import java.io.Serializable;
 
-import javax.enterprise.context.SessionScoped;
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.validator.ValidatorException;
 import javax.inject.Named;
+   // or import javax.faces.bean.ManagedBean;
+import javax.enterprise.context.SessionScoped;
    // or import javax.faces.bean.SessionScoped;
 
 @Named("user") // or @ManagedBean(name="user")
@@ -23,9 +24,8 @@
    public void setPassword(String newValue) { password = newValue; }
    
    public void validateName(FacesContext fc, UIComponent c, Object value) {
-         if ( ((String)value).contains("_") )
-            throw new ValidatorException(
-               new FacesMessage("Name cannot contain underscores"));
-         
+          if (((String) value).contains("_"))
+             throw new ValidatorException(
+                new FacesMessage("Name cannot contain underscores"));
    }
 }
\ No newline at end of file
Index: ch10/validation/web/login.xhtml
===================================================================
--- ch10/validation/web/login.xhtml     (revision 173)
+++ ch10/validation/web/login.xhtml     (revision 174)
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
-   <h:head>
-      <title>#{msgs.loginWindowTitle}</title>
-   </h:head>
-   
-   <h:body style="background: #fefeef">   
-      <h:form>
-         <h3>#{msgs.loginHeading}</h3>
-         <h:panelGrid columns="2">
-
-            #{msgs.namePrompt}
-            <h:panelGroup>
-                   <h:inputText value="#{user.name}" id="name"
-                      validator="#{user.validateName}">
-                      <f:ajax event="keyup" render="nameError"/>
-                   </h:inputText>
-                   
-                   <h:message id="nameError" for="name" style="color: red"/>
-            </h:panelGroup>
-            
-            #{msgs.passwordPrompt}
-            <h:inputSecret value="#{user.password}" id="password"
-              size="8"/>
-              
-            <h:commandButton value="#{msgs.loginButtonText}"
-               action="welcome"/>            
-         </h:panelGrid>
-      </h:form>
-   </h:body>
-</html>
\ No newline at end of file
Index: ch10/validation/web/index.xhtml
===================================================================
--- ch10/validation/web/index.xhtml     (revision 0)
+++ ch10/validation/web/index.xhtml     (revision 174)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:h="http://java.sun.com/jsf/html";
+      xmlns:f="http://java.sun.com/jsf/core";>
+   <h:head>
+      <title>#{msgs.loginWindowTitle}</title>
+   </h:head>
+   
+   <h:body style="background: #fefeef">   
+      <h:form>
+         <h3>#{msgs.loginHeading}</h3>
+         <h:panelGrid columns="2">
+
+            #{msgs.namePrompt}
+            <h:panelGroup>
+                   <h:inputText value="#{user.name}" id="name"
+                         validator="#{user.validateName}">
+                      <f:ajax event="keyup" render="nameError"/>
+                   </h:inputText>
+                   
+                   <h:message id="nameError" for="name" style="color: red"/>
+            </h:panelGroup>
+            
+            #{msgs.passwordPrompt}
+            <h:inputSecret value="#{user.password}" id="password" size="8"/>
+              
+            <h:commandButton value="#{msgs.loginButtonText}"
+               action="welcome"/>            
+         </h:panelGrid>
+      </h:form>
+   </h:body>
+</html>
\ No newline at end of file
Index: ch10/validation/web/welcome.xhtml
===================================================================
--- ch10/validation/web/welcome.xhtml   (revision 173)
+++ ch10/validation/web/welcome.xhtml   (revision 174)
@@ -2,8 +2,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
+      xmlns:h="http://java.sun.com/jsf/html";>
    <h:head>
       <title>#{msgs.loginWindowTitle}</title>
    </h:head>
Index: ch10/validation/web/WEB-INF/sun-web.xml
===================================================================
--- ch10/validation/web/WEB-INF/sun-web.xml     (revision 173)
+++ ch10/validation/web/WEB-INF/sun-web.xml     (revision 174)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application 
Server 9.0 Servlet 2.5//EN" 
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd";>
 <sun-web-app error-url="">
-  <context-root>/login_ajax</context-root>
+  <context-root>validation</context-root>
   <class-loader delegate="true"/>
   <jsp-config>
     <property name="keepgenerated" value="true">
Index: ch10/validation/web/WEB-INF/web.xml
===================================================================
--- ch10/validation/web/WEB-INF/web.xml (revision 173)
+++ ch10/validation/web/WEB-INF/web.xml (revision 174)
@@ -14,7 +14,7 @@
       <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
-      <welcome-file>faces/login.xhtml</welcome-file>
+      <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
       <param-name>javax.faces.PROJECT_STAGE</param-name>

Property changes on: ch10/validation
___________________________________________________________________
Added: svn:ignore
   + build


Index: ch10/echo/web/login.xhtml
===================================================================
--- ch10/echo/web/login.xhtml   (revision 173)
+++ ch10/echo/web/login.xhtml   (revision 174)
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
-<html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
-   <h:head>
-      <title>#{msgs.loginWindowTitle}</title>
-   </h:head>
-   
-   <h:body style="background: #fefeef">   
-      <h:form>
-         <h3>#{msgs.loginHeading}</h3>
-         <h:panelGrid columns="2">
-
-            #{msgs.namePrompt}
-                               <h:inputText value="#{user.name}" id="name">
-                                 <f:ajax event="keyup" render="echo"/>
-                               </h:inputText>
-                               
-            #{msgs.passwordPrompt}
-            <h:inputSecret value="#{user.password}" id="password"
-              size="8"/>
-              
-            <h:commandButton value="#{msgs.loginButtonText}"
-               action="welcome"/>            
-         </h:panelGrid>
-         
-         <p><h:outputText id="echo" value="#{user.name}"/></p>
-      </h:form>
-   </h:body>
-</html>
\ No newline at end of file
Index: ch10/echo/web/index.xhtml
===================================================================
--- ch10/echo/web/index.xhtml   (revision 0)
+++ ch10/echo/web/index.xhtml   (revision 174)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
+<html xmlns="http://www.w3.org/1999/xhtml";
+      xmlns:h="http://java.sun.com/jsf/html";
+      xmlns:f="http://java.sun.com/jsf/core";>
+   <h:head>
+      <title>#{msgs.loginWindowTitle}</title>
+   </h:head>
+   
+   <h:body style="background: #fefeef">   
+      <h:form>
+         <h3>#{msgs.loginHeading}</h3>
+         <h:panelGrid columns="2">
+
+            #{msgs.namePrompt}
+                               <h:inputText value="#{user.name}" id="name">
+                                 <f:ajax event="keyup" render="echo"/>
+                               </h:inputText>
+                               
+            #{msgs.passwordPrompt}
+            <h:inputSecret value="#{user.password}" id="password" size="8"/>
+              
+            <h:commandButton value="#{msgs.loginButtonText}" 
action="welcome"/>            
+         </h:panelGrid>
+         
+         <p><h:outputText id="echo" value="#{user.name}"/></p>
+      </h:form>
+   </h:body>
+</html>
\ No newline at end of file
Index: ch10/echo/web/welcome.xhtml
===================================================================
--- ch10/echo/web/welcome.xhtml (revision 173)
+++ ch10/echo/web/welcome.xhtml (revision 174)
@@ -2,8 +2,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml";
-      xmlns:h="http://java.sun.com/jsf/html";
-      xmlns:f="http://java.sun.com/jsf/core";>
+      xmlns:h="http://java.sun.com/jsf/html";>
    <h:head>
       <title>#{msgs.loginWindowTitle}</title>
    </h:head>
Index: ch10/echo/web/WEB-INF/sun-web.xml
===================================================================
--- ch10/echo/web/WEB-INF/sun-web.xml   (revision 173)
+++ ch10/echo/web/WEB-INF/sun-web.xml   (revision 174)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application 
Server 9.0 Servlet 2.5//EN" 
"http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd";>
 <sun-web-app error-url="">
-  <context-root>/login_ajax</context-root>
+  <context-root>echo</context-root>
   <class-loader delegate="true"/>
   <jsp-config>
     <property name="keepgenerated" value="true">
Index: ch10/echo/web/WEB-INF/web.xml
===================================================================
--- ch10/echo/web/WEB-INF/web.xml       (revision 173)
+++ ch10/echo/web/WEB-INF/web.xml       (revision 174)
@@ -14,7 +14,7 @@
       <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
-      <welcome-file>faces/login.xhtml</welcome-file>
+      <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>
    <context-param>
       <param-name>javax.faces.PROJECT_STAGE</param-name>

Property changes on: ch10/echo
___________________________________________________________________
Added: svn:ignore
   + build







[corejsf~subversion:174] cleaned up ch10

cayhorstmann 02/12/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close