struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddew...@apache.org
Subject svn commit: r492030 - in /struts/struts2/trunk/apps/showcase/src/main: java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java webapp/tags/ui/lotsOfOptiontransferselect.jsp webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp
Date Wed, 03 Jan 2007 02:55:43 GMT
Author: ddewolf
Date: Tue Jan  2 18:55:43 2007
New Revision: 492030

URL: http://svn.apache.org/viewvc?view=rev&rev=492030
Log:
WW-1557, Example of how to use the select value with multiple=true

Modified:
    struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java
    struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp
    struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp

Modified: struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java?view=diff&rev=492030&r1=492029&r2=492030
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/java/org/apache/struts2/showcase/LotsOfOptiontransferselectAction.java
Tue Jan  2 18:55:43 2007
@@ -23,6 +23,7 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.ArrayList;
 
 import com.opensymphony.xwork2.ActionSupport;
 
@@ -45,6 +46,8 @@
     private List _favouriteSportsKeys;
     private List _nonFavouriteSportsKeys;
 
+    private List _favouriteCities;
+
     private List _prioritisedFavouriteCartoonCharacters;
     private List _prioritisedFavouriteCars;
     private List _prioritisedFavouriteCountries;
@@ -247,6 +250,29 @@
 
 
 
+    public Map getAvailableCities() {
+        Map map = new LinkedHashMap();
+        map.put("boston", "Boston");
+        map.put("new york", "New York");
+        map.put("london", "London");
+        map.put("rome", "Rome");
+        return map;
+    }
+
+    public List getDefaultFavouriteCities() {
+        List list = new ArrayList();
+        list.add("boston");
+        list.add("rome");
+        return list;
+    }
+
+    public List getFavouriteCities() {
+        return _favouriteCities;
+    }
+
+    public void setFavouriteCities(List favouriteCities) {
+        this._favouriteCities = favouriteCities;
+    }
 
     // actions
 

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp?view=diff&rev=492030&r1=492029&r2=492030
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselect.jsp
Tue Jan  2 18:55:43 2007
@@ -116,7 +116,13 @@
         value="{'england', 'brazil'}" />    
         
     <br/>
-    
+
+    <s:select label="Favourite Cities"
+        list="availableCities"
+        name="favouriteCities"
+        value="%{defaultFavouriteCities}"
+        multiple="true" size="4"/>
+
     <s:submit value="Submit It" />
     
     <br/>

Modified: struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp?view=diff&rev=492030&r1=492029&r2=492030
==============================================================================
--- struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp
(original)
+++ struts/struts2/trunk/apps/showcase/src/main/webapp/tags/ui/lotsOfOptiontransferselectSubmit.jsp
Tue Jan  2 18:55:43 2007
@@ -71,6 +71,24 @@
             </s:iterator>
         </td>
     </tr>
+      <tr>
+        <td>Favourite Sports:</td>
+        <td>
+            <s:iterator value="favouriteSports" status="stat">
+                <s:property value="%{#stat.count}" />.<s:property />&nbsp;
+            </s:iterator>
+        </td>
+    </tr>
+
+     <tr>
+        <td>Non Favourite Sports:</td>
+        <td>
+            <s:iterator value="nonfavouriteSports" status="stat">
+                <s:property value="%{#stat.count}" />.<s:property />&nbsp;
+            </s:iterator>
+        </td>
+    </tr>
+
     <tr>
         <td>Prioritised Favourite Cartoon Characters:</td>
         <td>
@@ -91,6 +109,14 @@
         <td>Prioritised Favourite Countries</td>
         <td>
             <s:iterator value="prioritisedFavouriteCountries" status="stat">
+                <s:property value="%{#stat.count}" />.<s:property />&nbsp;
+            </s:iterator>
+        </td>
+    </tr>
+        <tr>
+        <td>Favourite Cities</td>
+        <td>
+            <s:iterator value="favouriteCities" status="stat">
                 <s:property value="%{#stat.count}" />.<s:property />&nbsp;
             </s:iterator>
         </td>



Mime
View raw message