You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by gv...@apache.org on 2005/09/17 04:37:33 UTC

svn commit: r289688 - in /struts/shale/trunk: clay-plugin/src/conf/ clay-plugin/src/java/org/apache/shale/clay/component/ clay-plugin/src/java/org/apache/shale/clay/config/beans/ use-cases/src/java/org/apache/shale/usecases/view/ use-cases/src/web/WEB-...

Author: gvanmatre
Date: Fri Sep 16 19:37:18 2005
New Revision: 289688

URL: http://svn.apache.org/viewcvs?rev=289688&view=rev
Log:
Bug#: 35935 loadBundle component for clay HTML templates

Modified:
    struts/shale/trunk/clay-plugin/src/conf/view-config.xml
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
    struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties
    struts/shale/trunk/use-cases/src/web/WEB-INF/clay-config.xml
    struts/shale/trunk/use-cases/src/web/rolodex/hrolodex.html
    struts/shale/trunk/use-cases/src/web/rolodex/rolodex.jsp

Modified: struts/shale/trunk/clay-plugin/src/conf/view-config.xml
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/conf/view-config.xml?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/conf/view-config.xml (original)
+++ struts/shale/trunk/clay-plugin/src/conf/view-config.xml Fri Sep 16 19:37:18 2005
@@ -1154,7 +1154,6 @@
        allowBody="false">
     <attributes>
       <set name="basename" />
-      <set name="scope" value="request"/>
       <set name="var" value="msgs"/> 
     </attributes>
   </component>	

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/LoadBundle.java Fri Sep 16 19:37:18 2005
@@ -1,216 +1,222 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.TreeMap;
-
-import javax.faces.component.UIComponentBase;
-import javax.faces.context.FacesContext;
-import javax.faces.el.ValueBinding;
-
-/**
- * <p>This component is meant to simulate the JSF loadBundle JSP tag for full 
- * {@link Clay} HTML views.  It adds a scope property not found in the JSF JSP RI Tag.  
- * This component is not immune to the rendered property like the JSP loadBundle tag.  
- * This means that if this component is nested in a component and the rendered attribute 
- * is false, the message bundle might not get loaded into the specified scope.  
- * </p>
- */
-public class LoadBundle extends UIComponentBase {
-
-    /**
-     * <p>Base bundle name of the target properties file.</p>
-     */
-    private String basename = null;
-    
-    /**
-     * <p>Key that the bundle will be loaded into session scope.</p>
-     */
-    private String var = null;
-    
-    /**
-     * <p>The scope the {@link org.apache.shale.clay.component.LoadBundle$BundleMap} 
-     * will be cached using the <code>var</code> as a key.  The default
-     * is "request" scope.</p>
-     */
-    private String scope = "request";
-    
-    
-    
-    /**
-     * <p>This component is not associated with a family.  
-     * Returns <code>null</code>.</p>
-     */
-    public String getFamily() {
-        return null;
-    }
-
-    /**
-     * <p>This component doesn't have a renderer and
-     * returns <code>null</code></p>
-     */
-    public String getRendererType() {
-       return null;
-    }
-
-    /**
-     *  <p>Resource bundle wrappered in a Map.</p>
-     */
-    private class BundleMap extends TreeMap {
-        
-        /**
-         * <p>Loads the resource bundle into a Map.</p> 
-         */
-        public BundleMap(ResourceBundle bundle) {
-           Enumeration ki = bundle.getKeys();
-           while (ki.hasMoreElements()) {
-               String key = (String) ki.nextElement();
-               String value = bundle.getString(key);
-               super.put(key, value);
-           }
-           
-        }
-
-        /**
-         * <p>Returns the message string for the key.  If the key doesn't
-         * exist, a friendly value "?key?" is returned for debuging.</p>
-         */
-        public Object get(Object key) {
-          
-            String value =  (String) super.get(key);
-            if (value == null) 
-               value = "?" + key + "?";
-            
-            return value;
-        }
-                 
-    };
-    
-    /**
-     * <p>Loads the resource bundle identified by the <code>basename</code>
-     * into <code>scope</code> using the <code>var</code> property as a key.</p>
-     */
-    public void encodeBegin(FacesContext context) throws IOException {
-        super.encodeBegin(context);
-          
-        StringBuffer targetExp = new StringBuffer();
-        targetExp.append("#{").append(getScope())
-                 .append("Scope").append("['")
-                 .append(getVar()).append("']}");
-        
-        ValueBinding vb = context.getApplication().createValueBinding(targetExp.toString());
-        
-        Map mapBundle = (Map) vb.getValue(context);
-        
-        if (mapBundle == null) {
-            Locale locale = context.getViewRoot().getLocale();
-            if (locale == null)
-               locale = context.getApplication().getDefaultLocale();
-            
-            ClassLoader classloader = Thread.currentThread().getContextClassLoader();
-            if(classloader == null)
-                classloader = this.getClass().getClassLoader();
-            
-            ResourceBundle bundle = ResourceBundle.getBundle(getBasename(), locale, classloader);
-            
-            mapBundle = new BundleMap(bundle);
-        }
-
-        vb.setValue(context, mapBundle);
-        
-    }
-
-    /**
-     * <p>Returns the name of the resource bundle.</p>
-     */
-    public String getBasename() {
-        return basename;
-    }
-    
-
-    /**
-     * <p>Sets the resource bundle name.</p>
-     */
-    public void setBasename(String basename) {
-        this.basename = basename;
-    }
-    
-
-    /**
-     * <p>Returns the key name the 
-     * {@link org.apache.shale.clay.component.LoadBundle$BundleMap} will be
-     * cached in <code>scope</code>.</p>
-     */
-    public String getVar() {
-        return var;
-    }
-    
-
-    /**
-     * <p>Sets the key name the 
-     * {@link org.apache.shale.clay.component.LoadBundle$BundleMap} will be
-     * cached in <code>scope</code>.</p>
-     */
-    public void setVar(String var) {
-        this.var = var;
-    }
-
-    /**
-     * <p>Returns the scope the 
-     * {@link org.apache.shale.clay.component.LoadBundle$BundleMap} will be cached.
-     * The valid enumerations are (request, session and application). 
-     * The default is "request" if a value is not specified.</p>
-     */
-    public String getScope() {
-        if (scope == null)
-          return "request";
-        else if (scope.equals("request") ||
-                 scope.equals("session") ||
-                 scope.equals("application")) {
-           return scope;
-        } else {
-           return "request";
-        }
-          
-    }
-    
-
-    /**
-    * <p>Sets the scope the 
-    * {@link org.apache.shale.clay.component.LoadBundle$BundleMap} will be cached.
-    * The valid enumerations are (request, session and application).
-    * </p>
-    */
-    public void setScope(String scope) {
-        this.scope = scope;
-    }
-
-    /**
-     * <p>Force the rendered property to <code>true</code>.</p>
-     */
-    public boolean isRendered() {    
-        return true;
-    }
-     
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import org.apache.shale.faces.ShaleConstants;
+import org.apache.shale.util.Tags;
+
+/**
+ * Component counterpart of the standard loadBundle tag. Since it's a component
+ * it can be used with HTML templates.
+ */
+public class LoadBundle extends UIComponentBase {
+    /**
+     * Base name of the resource bundle to be loaded.
+     */
+    private String basename = null;
+
+    /**
+     * Name of a request scope attribute under which the resource bundle will be
+     * exposed as a Map.
+     */
+    private String var = null;
+
+    public String getFamily() {
+        return null;
+    }
+
+    /**
+     * Sets the base name of the resource bundle to be loaded.
+     */
+    public void setBasename(String basename) {
+        this.basename = basename;
+        if ((var != null) && (basename != null))
+            loadBundle();
+    }
+
+    /**
+     * Sets the name of a request scope attribute under which the resource
+     * bundle will be exposed as a Map.
+     */
+    public void setVar(String var) {
+        this.var = var;
+        if ((var != null) && (basename != null))
+            loadBundle();
+    }
+
+    /**
+     * Load the resource bundle and expose it in the request.
+     */
+    private void loadBundle() {
+        // get the current context
+        FacesContext context = FacesContext.getCurrentInstance();
+        if (context == null) {
+            throw new NullPointerException("No faces context!");
+        }
+
+        // get the ClassLoader
+        ClassLoader classLoader = Thread.currentThread()
+                .getContextClassLoader();
+        if (classLoader == null)
+            classLoader = getClass().getClassLoader();
+
+        // get the Tag Utilities
+        Tags tagUtils = (Tags) context.getApplication().getVariableResolver()
+                .resolveVariable(context, ShaleConstants.TAG_UTILITY_BEAN);
+
+        // evaluate any VB expression that we were passed
+        String resolvedBasename = (String) tagUtils.eval(basename);
+
+        if (null == resolvedBasename || null == var) {
+            throw new NullPointerException("null basename or var");
+        }
+
+        final ResourceBundle bundle = ResourceBundle.getBundle(basename,
+                context.getViewRoot().getLocale(), classLoader);
+        if (null == bundle) {
+            throw new NullPointerException("No ResourceBundle for " + basename);
+        }
+
+        context.getExternalContext().getRequestMap().put(var, new BundleMap(bundle));
+
+    }
+
+    public void encodeBegin(FacesContext context) throws IOException {
+        // ensure that this component is always transient
+        setTransient(true);
+
+        super.encodeBegin(context);
+    }
+
+    private static class BundleMap implements Map {
+        private ResourceBundle _bundle;
+
+        private List _values;
+
+        public BundleMap(ResourceBundle bundle) {
+            _bundle = bundle;
+        }
+
+        public Object get(Object key) {
+            try {
+                return _bundle.getObject(key.toString());
+            } catch (Exception e) {
+                return "???" + key + "???";
+            }
+        }
+
+        public boolean isEmpty() {
+            return !_bundle.getKeys().hasMoreElements();
+        }
+
+        public boolean containsKey(Object key) {
+            return _bundle.getObject(key.toString()) != null;
+        }
+
+        public Collection values() {
+            if (_values == null) {
+                _values = new ArrayList();
+                for (Enumeration enumer = _bundle.getKeys(); enumer
+                        .hasMoreElements();) {
+                    String v = _bundle.getString((String) enumer.nextElement());
+                    _values.add(v);
+                }
+            }
+            return _values;
+        }
+
+        public int size() {
+            return values().size();
+        }
+
+        public boolean containsValue(Object value) {
+            return values().contains(value);
+        }
+
+        public Set entrySet() {
+            Set set = new HashSet();
+            for (Enumeration enumer = _bundle.getKeys(); enumer
+                    .hasMoreElements();) {
+                final String k = (String) enumer.nextElement();
+                set.add(new Map.Entry() {
+                    public Object getKey() {
+                        return k;
+                    }
+
+                    public Object getValue() {
+                        return _bundle.getObject(k);
+                    }
+
+                    public Object setValue(Object value) {
+                        throw new UnsupportedOperationException(this.getClass()
+                                .getName()
+                                + " UnsupportedOperationException");
+                    }
+                });
+            }
+            return set;
+        }
+
+        public Set keySet() {
+            Set set = new HashSet();
+            for (Enumeration enumer = _bundle.getKeys(); enumer
+                    .hasMoreElements();) {
+                set.add(enumer.nextElement());
+            }
+            return set;
+        }
+
+        // Unsupported methods
+
+        public Object remove(Object key) {
+            throw new UnsupportedOperationException(this.getClass().getName()
+                    + " UnsupportedOperationException");
+        }
+
+        public void putAll(Map t) {
+            throw new UnsupportedOperationException(this.getClass().getName()
+                    + " UnsupportedOperationException");
+        }
+
+        public Object put(Object key, Object value) {
+            throw new UnsupportedOperationException(this.getClass().getName()
+                    + " UnsupportedOperationException");
+        }
+
+        public void clear() {
+            throw new UnsupportedOperationException(this.getClass().getName()
+                    + " UnsupportedOperationException");
+        }
+
+    }
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/config/beans/TemplateConfigBean.java Fri Sep 16 19:37:18 2005
@@ -122,5 +122,6 @@
         
         isWatchDogOn = true;
     }
+
     
 }

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle.properties Fri Sep 16 19:37:18 2005
@@ -147,3 +147,21 @@
 tiles.test.thank.you.title=Thank You
 tiles.test.payment.heading=Please enter your payment information
 tiles.test.payment.thank.you.heading=Thank you for your payment!
+
+# Rolodex
+rolodex.contactTable.nameColumn.title=Contacts
+rolodex.address.street1=Street 1:
+rolodex.address.street2=Street 2:
+rolodex.address.city=City:
+rolodex.address.state=State:
+rolodex.address.zip=Zip:
+rolodex.address.phone=Phone:
+rolodex.address.province=Province:
+rolodex.address.country=Country:
+rolodex.address.residentialAddress=Residential Address
+rolodex.address.businessAddress=Business Address
+rolodex.name=Name:
+rolodex.email=Email
+rolodex.button.new=New Contact
+rolodex.button.save=Save Contact
+rolodex.button.delete=Delete Contact

Modified: struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties (original)
+++ struts/shale/trunk/use-cases/src/java/org/apache/shale/usecases/view/Bundle_de.properties Fri Sep 16 19:37:18 2005
@@ -84,3 +84,21 @@
 validate.test.unknown.credit.card.type=Unknown Credit Card Type
 validate.test.bad.expiration.date=Bad Expiration Date. Enter the date in this format: mm/dd/yyyy
 validate.test.description=This form has six validators, all implemented with s:commonsValidator:<p><ul><li>Amount: <strong>floatRange</strong> (server)<li>Credit Card Number: <strong>required</strong> (server) <strong>mask</strong> ([4-6].*) (client) and <strong>creditCard</strong> (server)<li>Expiration Date: <strong>required</strong> (client) <strong>date</strong> (server)</ul><p>Note: because of the Credit Card Number field's mix of client- and server-side validators, entering "33" in the field results in a JavaScript alert (because the mask validator catches it), but entering "55" results in server-side validation and a subsequent error message displayed in the form.<p>See the Apache Commons Validator documentation for more information about other available validators.
+
+# Rolodex
+rolodex.contactTable.nameColumn.title=Kontakte
+rolodex.address.street1=Straße 1:
+rolodex.address.street2=Straße 2:
+rolodex.address.city=Ort:
+rolodex.address.state=Bundesstaat:
+rolodex.address.zip=Plz:
+rolodex.address.phone=Telefon:
+rolodex.address.province=Provinz:
+rolodex.address.country=Land:
+rolodex.address.residentialAddress=Privatadresse
+rolodex.address.businessAddress=Geschäftsadresse
+rolodex.name=Name:
+rolodex.email=E-Mail
+rolodex.button.new=Neuer Kontakt
+rolodex.button.save=Kontakt speichern
+rolodex.button.delete=Kontakt löschen

Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/clay-config.xml
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/clay-config.xml?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/clay-config.xml (original)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/clay-config.xml Fri Sep 16 19:37:18 2005
@@ -24,7 +24,7 @@
   <component jsfid="nameColumn" extends="column" id="name">
     <element renderId="1" jsfid="outputText" facetName="header">
       <attributes>
-        <set name="value" value="Contacts" />
+        <set name="value" value="#{messages['rolodex.contactTable.nameColumn.title']}" />
       </attributes>
     </element> 
        
@@ -74,7 +74,7 @@
 	
 	<component jsfid="cityLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="City:" />		
+			  <set name="value" value="#{messages['rolodex.address.city']}" />		
 			  <set name="for"   value="city" />
 		   </attributes>
 	</component>				
@@ -95,7 +95,7 @@
 	<!-- province label, input field and message -->	
 	<component jsfid="provinceLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Province:" />		
+			  <set name="value" value="#{messages['rolodex.address.province']}" />
 			  <set name="for"   value="province" />
 		   </attributes>
 	</component>				
@@ -116,7 +116,7 @@
 	<!-- state label, input field and message -->	
 	<component jsfid="stateLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="State:" />		
+			  <set name="value" value="#{messages['rolodex.address.state']}" />		
 			  <set name="for"   value="state" />
 		   </attributes>
 	</component>				
@@ -143,7 +143,7 @@
 	<!-- country label, input field and message -->	
 	<component jsfid="countryLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Country:" />		
+			  <set name="value" value="#{messages['rolodex.address.country']}" />
 			  <set name="for"   value="country" />
 		   </attributes>
 	</component>				
@@ -170,7 +170,7 @@
 	<!-- zip code label, input field and message -->
 	<component jsfid="zipLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Zip:" />		
+			  <set name="value" value="#{messages['rolodex.address.zip']}" />
 			  <set name="for"   value="zip" />
 		   </attributes>
 	</component>					
@@ -200,7 +200,7 @@
 	<!-- street 1 label, input field and message -->
 	<component jsfid="street1Label" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Street 1:" />		
+			  <set name="value" value="#{messages['rolodex.address.street1']}" />
 			  <set name="for"   value="street1" />
 		   </attributes>
 	</component>				
@@ -219,7 +219,7 @@
 	<!-- street 2 label, input field and message -->
 	<component jsfid="street2Label" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Street 2:" />		
+			  <set name="value" value="#{messages['rolodex.address.street2']}" />
 			  <set name="for"   value="street2" />
 		   </attributes>
 	</component>				
@@ -245,7 +245,7 @@
     <!-- submit button to save a contact -->
     <component jsfid="saveCommand" extends="baseCommand"> 
 	   <attributes>
-	      <set name="value" value="Save Contact" />		
+	      <set name="value" value="#{messages['rolodex.button.save']}" />		
 		  <set name="action" value="#{managed-bean-name.saveContact}"  />	
 	   </attributes>
     </component>
@@ -253,7 +253,7 @@
     <!-- submit button to delete a contact -->
     <component jsfid="deleteCommand" extends="baseCommand"> 
 	   <attributes>
-	      <set name="value" value="Delete Contact" />		
+	      <set name="value" value="#{messages['rolodex.button.delete']}" />		
 		  <set name="action" value="#{managed-bean-name.deleteContact}"  />	
 	   </attributes>
     </component>
@@ -263,7 +263,7 @@
     <!-- Contact Name -->
 	<component jsfid="nameLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Name:" />		
+			  <set name="value" value="#{messages['rolodex.name']}" />		
 			  <set name="for"   value="name" />
 		   </attributes>
 	</component>				
@@ -284,7 +284,7 @@
     <!-- Contact email address -->
 	<component jsfid="emailLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Email:" />		
+			  <set name="value" value="#{messages['rolodex.email']}" />
 			  <set name="for"   value="email" />
 		   </attributes>
 	</component>				
@@ -305,7 +305,7 @@
     <!-- Contact residential Phone -->
 	<component jsfid="residentialPhoneLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Phone:" />		
+			  <set name="value" value="#{messages['rolodex.address.phone']}" />
 			  <set name="for"   value="residentialPhone" />
 		   </attributes>
 	</component>				
@@ -324,7 +324,7 @@
     <!-- Contact business Phone -->
 	<component jsfid="businessPhoneLabel" extends="baseLabel"> 
 		   <attributes>
-			  <set name="value" value="Phone:" />		
+			  <set name="value" value="#{messages['rolodex.address.phone']}" />		
 			  <set name="for"   value="businessPhone" />
 		   </attributes>
 	</component>				
@@ -431,7 +431,7 @@
 
 		<element renderId="0" jsfid="baseCommand"> 
 	      <attributes>
-	         <set name="value" value="New Contact" />		
+	         <set name="value" value="#{messages['rolodex.button.new']}" />		
 		     <set name="action" value="#{managed-bean-name.newContact}"  />	
              <set name="immediate" value="true"/>    
 	      </attributes>
@@ -452,7 +452,19 @@
     </component>
 
 
-<!--  HTML hroledex.html template -->
+<!--  HTML hrolodex.html template -->
+	<component jsfid="residentialAddressHeader" extends="outputText" allowBody="false">
+	   <attributes>
+	      <set name="value" value="#{messages['rolodex.address.residentialAddress']}" />
+	   </attributes>
+    </component>
+
+	<component jsfid="businessAddressHeader" extends="outputText" allowBody="false">
+	   <attributes>
+	      <set name="value" value="#{messages['rolodex.address.businessAddress']}" />
+	   </attributes>
+    </component>
+
 
     <!-- Nested Clay Component -->    
 	<component jsfid="tabs" extends="clay" id="tabs" allowBody="false">
@@ -468,6 +480,7 @@
 	   <attributes>
 		  <set name="action" value="#{managed-bean-name.saveContact}"/>	
           <set name="rendered" useValueLateBinding="true" value="#{!empty managed-bean-name.selectedContact}"/>
+	      <set name="value" value="#{messages['rolodex.button.save']}" />
 	   </attributes>
     </component>
 
@@ -476,6 +489,7 @@
 	   <attributes>
 		  <set name="action" value="#{managed-bean-name.deleteContact}"/>
           <set name="rendered" useValueLateBinding="true" value="#{!empty managed-bean-name.selectedContact}"/>	
+	      <set name="value" value="#{messages['rolodex.button.delete']}" />
 	   </attributes>
     </component>
 
@@ -484,14 +498,16 @@
 	   <attributes>
 		  <set name="action" value="#{managed-bean-name.newContact}"  />	
           <set name="immediate" value="true"/>    
+	      <set name="value" value="#{messages['rolodex.button.new']}" />
 	   </attributes>
     </component>
 
 
     <!-- Contact Name -->
-	<component jsfid="contactNameLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="contactNameLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="contactName" />
+		      <set name="value" value="#{messages['rolodex.name']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="contactName" extends="inputText" id="contactName"> 
@@ -507,9 +523,10 @@
 	</component>
 
     <!-- Contact email address -->
-	<component jsfid="contactEmailLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="contactEmailLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="contactEmail" />
+		      <set name="value" value="#{messages['rolodex.email']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="contactEmail" extends="inputText" id="contactEmail"> 
@@ -525,9 +542,10 @@
 	</component>
 
 	<!-- residential city -->
-	<component jsfid="residentialCityLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="residentialCityLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="residentialCity" />
+		      <set name="value" value="#{messages['rolodex.address.city']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="residentialCity" extends="inputText" id="residentialCity"> 
@@ -544,9 +562,10 @@
 
 
 	<!-- business city -->
-	<component jsfid="businessCityLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessCityLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessCity" />
+		      <set name="value" value="#{messages['rolodex.address.city']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessCity" extends="inputText" id="businessCity"> 
@@ -563,9 +582,10 @@
 
 
 	<!-- residential street 1 label, input field and message -->
-	<component jsfid="residentialStreet1Label" extends="outputLabel" allowBody="true"> 
+	<component jsfid="residentialStreet1Label" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="residentialStreet1" />
+		      <set name="value" value="#{messages['rolodex.address.street1']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="residentialStreet1" extends="inputText" id="residentialStreet1"> 
@@ -581,9 +601,10 @@
 	</component>
 
 	<!-- business street 1 label, input field and message -->
-	<component jsfid="businessStreet1Label" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessStreet1Label" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessStreet1" />
+		      <set name="value" value="#{messages['rolodex.address.street1']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessStreet1" extends="inputText" id="businessStreet1"> 
@@ -600,9 +621,10 @@
 
 
 	<!-- residential street 2 label, input field and message -->
-	<component jsfid="residentialStreet2Label" extends="outputLabel" allowBody="true"> 
+	<component jsfid="residentialStreet2Label" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="residentialStreet2" />
+		      <set name="value" value="#{messages['rolodex.address.street2']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="residentialStreet2" extends="inputText" id="residentialStreet2"> 
@@ -618,9 +640,10 @@
 	</component>
 
 	<!-- business street 2 label, input field and message -->
-	<component jsfid="businessStreet2Label" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessStreet2Label" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessStreet2" />
+		      <set name="value" value="#{messages['rolodex.address.street2']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessStreet2" extends="inputText" id="businessStreet2"> 
@@ -637,9 +660,10 @@
 
 
 	<!-- residential state label, input field and message -->	
-	<component jsfid="residentialStateLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="residentialStateLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="residentialState" />
+		      <set name="value" value="#{messages['rolodex.address.state']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="residentialState" extends="selectOneMenu" id="residentialState" allowBody="false"> 
@@ -662,9 +686,10 @@
 
 
 	<!-- business state label, input field and message -->	
-	<component jsfid="businessStateLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessStateLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessState" />
+		      <set name="value" value="#{messages['rolodex.address.state']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessState" extends="selectOneMenu" id="businessState" allowBody="false"> 
@@ -687,9 +712,10 @@
 
 
 	<!-- residential zip code label, input field and message -->
-	<component jsfid="residentialZipLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="residentialZipLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="residentialZip" />
+		      <set name="value" value="#{messages['rolodex.address.zip']}" />
 		   </attributes>
 	</component>					
 	<component jsfid="residentialZip" id="residentialZip" extends="inputText"> 
@@ -705,9 +731,10 @@
 	</component>
 
 	<!-- business zip code label, input field and message -->
-	<component jsfid="businessZipLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessZipLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessZip" />
+		      <set name="value" value="#{messages['rolodex.address.zip']}" />
 		   </attributes>
 	</component>					
 	<component jsfid="businessZip" id="businessZip" extends="inputText"> 
@@ -725,9 +752,10 @@
 
 
    <!-- Contact residential Phone -->
-	<component jsfid="contactResidentialPhoneLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="contactResidentialPhoneLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="contactResidentialPhone" />
+		      <set name="value" value="#{messages['rolodex.address.phone']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="contactResidentialPhone" extends="inputText" id="contactResidentialPhone"> 
@@ -743,9 +771,10 @@
 	</component>
 
    <!-- Contact business Phone -->
-	<component jsfid="contactBusinessPhoneLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="contactBusinessPhoneLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="contactBusinessPhone" />
+		      <set name="value" value="#{messages['rolodex.address.phone']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="contactBusinessPhone" extends="inputText" id="contactBusinessPhone"> 
@@ -762,9 +791,10 @@
 
 
 	<!-- business province label, input field and message -->	
-	<component jsfid="businessProvinceLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessProvinceLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessProvince" />
+		      <set name="value" value="#{messages['rolodex.address.province']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessProvince" extends="inputText" id="businessProvince"> 
@@ -781,9 +811,10 @@
 
 
 	<!-- business country label, input field and message -->	
-	<component jsfid="businessCountryLabel" extends="outputLabel" allowBody="true"> 
+	<component jsfid="businessCountryLabel" extends="outputLabel" allowBody="false"> 
 		   <attributes>
 			  <set name="for"   value="businessCountry" />
+		      <set name="value" value="#{messages['rolodex.address.country']}" />
 		   </attributes>
 	</component>				
 	<component jsfid="businessCountry" extends="selectOneMenu" id="businessCountry" allowBody="false"> 

Modified: struts/shale/trunk/use-cases/src/web/rolodex/hrolodex.html
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/rolodex/hrolodex.html?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/web/rolodex/hrolodex.html (original)
+++ struts/shale/trunk/use-cases/src/web/rolodex/hrolodex.html Fri Sep 16 19:37:18 2005
@@ -1,7 +1,7 @@
 <html>
 <head>
-<span jsfid="loadBundle" basename="org.apache.shale.usecases.view.Bundle" scope="session"/>
-<title>#{msgs['usecases.rolodex2']}</title>
+<span jsfid="loadBundle" basename="org.apache.shale.usecases.view.Bundle" var="messages"/>
+<title>#{messages['usecases.rolodex2']}</title>
 
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <style type="text/css" media="screen">
@@ -98,7 +98,7 @@
 }
 
 input.button {
-    width: 1in; 
+    width: 1.2in; 
     text-align: center; 
     color: #99CC66; 
     font-size: 12px; 
@@ -157,16 +157,16 @@
         </table>
      </td>
      <td>             
-        <input styleClass="button" class="button" class="button" type="submit" value="Save Contact" jsfid="contactSaveCommand"><br>
-        <input styleClass="button" class="button" type="submit" value="Delete Contact" jsfid="contactDeleteCommand"><br>
-        <input styleClass="button" class="button" type="submit" value="New Contact" jsfid="contactNewCommand"><br>     
+        <input styleClass="button" class="button" class="button" type="submit" jsfid="contactSaveCommand"><br>
+        <input styleClass="button" class="button" type="submit" jsfid="contactDeleteCommand"><br>
+        <input styleClass="button" class="button" type="submit" jsfid="contactNewCommand"><br>     
      </td>
     </tr>
     <tr>
      <td>
         <table border=0>
            <tr class="contactsHeader">
-              <td colspan="3">Residential Address:</td>
+              <td colspan="3"><span jsfid="residentialAddressHeader">Residential Address:</span></td>
            </tr>
            <tr>
                 <td><label style="color:#99CC66"  jsfid=residentialStreet1Label>Address 1:</label></td>
@@ -213,7 +213,7 @@
      <td>
         <table border=0>
            <tr class="contactsHeader">
-              <td colspan="3">Business Address:</td>
+              <td colspan="3"><span jsfid="businessAddressHeader">Business Address:</span></td>
            </tr>
            <tr>
                 <td><label style="color:#99CC66" jsfid=businessStreet1Label>Address 1:</label></td>

Modified: struts/shale/trunk/use-cases/src/web/rolodex/rolodex.jsp
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/rolodex/rolodex.jsp?rev=289688&r1=289687&r2=289688&view=diff
==============================================================================
--- struts/shale/trunk/use-cases/src/web/rolodex/rolodex.jsp (original)
+++ struts/shale/trunk/use-cases/src/web/rolodex/rolodex.jsp Fri Sep 16 19:37:18 2005
@@ -8,7 +8,7 @@
 <head>
 <title>Rolodex Example Using Clay</title>
 
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <style type="text/css" media="screen">
 body {
 	margin : 10px;
@@ -103,7 +103,7 @@
 }
 
 input.button {
-    width: 1in; 
+    width: 1.2in; 
     text-align: center; 
     color: #99CC66; 
     font-size: 12px; 
@@ -117,6 +117,7 @@
 </head>
 
 <f:view>
+<%@include file="../messages.jspf"%>
 	<body class="section-1">
 
 	<h:form>
@@ -138,8 +139,8 @@
 					managedBeanName="rolodex.selectedContact" />
 				<clay:clay id="commandPanel" jsfid="commandPanel"
 					managedBeanName="rolodex" />
-				<h:outputText value="Residential Address:" style="color:#66B9CC"/>
-				<h:outputText value="Business Address:" style="color:#66B9CC"/>
+				<h:outputText value="#{messages['rolodex.address.residentialAddress']}" style="color:#66B9CC"/>
+				<h:outputText value="#{messages['rolodex.address.businessAddress']}" style="color:#66B9CC"/>
 				<!-- clay:clay id="address1" jsfid="addressPanel"
 					managedBeanName="rolodex.selectedContact.residentialAddress" / -->
 				<clay:clay id="address1" jsfid="rolodex/address.html"



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org