Home » struts-2.1.8.1-src » org.apache » struts2 » showcase » [javadoc | source]

    1   /*
    2    * $Id: MoreSelectsAction.java 590812 2007-10-31 20:32:54Z apetrelli $
    3    *
    4    * Licensed to the Apache Software Foundation (ASF) under one
    5    * or more contributor license agreements.  See the NOTICE file
    6    * distributed with this work for additional information
    7    * regarding copyright ownership.  The ASF licenses this file
    8    * to you under the Apache License, Version 2.0 (the
    9    * "License"); you may not use this file except in compliance
   10    * with the License.  You may obtain a copy of the License at
   11    *
   12    *  http://www.apache.org/licenses/LICENSE-2.0
   13    *
   14    * Unless required by applicable law or agreed to in writing,
   15    * software distributed under the License is distributed on an
   16    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   17    * KIND, either express or implied.  See the License for the
   18    * specific language governing permissions and limitations
   19    * under the License.
   20    */
   21   package org.apache.struts2.showcase;
   22   
   23   import com.opensymphony.xwork2.ActionSupport;
   24   
   25   import java.util.List;
   26   import java.util.Map;
   27   import java.util.LinkedHashMap;
   28   import java.util.ArrayList;
   29   
   30   /**
   31    */
   32   public class MoreSelectsAction extends ActionSupport {
   33   
   34   
   35       private List _prioritisedFavouriteCartoonCharacters;
   36       private List _prioritisedFavouriteCars;
   37       private List _prioritisedFavouriteCountries;
   38       private List favouriteNumbers;
   39   
   40   
   41       // Cartoon Characters
   42       public Map getDefaultFavouriteCartoonCharacters() {
   43           Map m = new LinkedHashMap();
   44           m.put("heMan", "He-Man");
   45           m.put("popeye", "Popeye");
   46           m.put("mockeyMouse", "Mickey Mouse");
   47           return m;
   48       }
   49   
   50   
   51       // Cars
   52       public Map getDefaultFavouriteCars() {
   53           Map m = new LinkedHashMap();
   54           m.put("alfaRomeo", "Alfa Romeo");
   55           m.put("Toyota", "Toyota");
   56           m.put("Mitsubitshi", "Mitsubitshi");
   57           return m;
   58       }
   59   
   60   
   61   
   62       // Countries
   63       public Map getDefaultFavouriteCountries() {
   64           Map m = new LinkedHashMap();
   65           m.put("england", "England");
   66           m.put("america", "America");
   67           m.put("brazil", "Brazil");
   68           return m;
   69       }
   70   
   71       public List getDefaultFavouriteNumbers() {
   72           List list = new ArrayList();
   73           list.add("Three");
   74           list.add("Seven");
   75           return list;
   76       }
   77   
   78   
   79   
   80       public List getPrioritisedFavouriteCartoonCharacters() {
   81           return _prioritisedFavouriteCartoonCharacters;
   82       }
   83       public void setPrioritisedFavouriteCartoonCharacters(List prioritisedFavouriteCartoonCharacters) {
   84           _prioritisedFavouriteCartoonCharacters = prioritisedFavouriteCartoonCharacters;
   85       }
   86   
   87       public List getPrioritisedFavouriteCars() {
   88           return _prioritisedFavouriteCars;
   89       }
   90       public void setPrioritisedFavouriteCars(List prioritisedFavouriteCars) {
   91           _prioritisedFavouriteCars = prioritisedFavouriteCars;
   92       }
   93   
   94   
   95       public List getPrioritisedFavouriteCountries() {
   96           return _prioritisedFavouriteCountries;
   97       }
   98       public void setPrioritisedFavouriteCountries(List prioritisedFavouriteCountries) {
   99           _prioritisedFavouriteCountries = prioritisedFavouriteCountries;
  100       }
  101   
  102       public List getFavouriteNumbers() {
  103           return favouriteNumbers;
  104       }
  105   
  106       public void setFavouriteNumbers(List favouriteNumbers) {
  107           this.favouriteNumbers = favouriteNumbers;
  108       }
  109   
  110       public Map getAvailableCities() {
  111           Map map = new LinkedHashMap();
  112           map.put("boston", "Boston");
  113           map.put("new york", "New York");
  114           map.put("london", "London");
  115           map.put("rome", "Rome");
  116           return map;
  117       }
  118   
  119       public List getDefaultFavouriteCities() {
  120           List list = new ArrayList();
  121           list.add("boston");
  122           list.add("rome");
  123           return list;
  124       }
  125   
  126       // actions
  127   
  128       public String input() throws Exception {
  129           return SUCCESS;
  130       }
  131   
  132       public String submit() throws Exception {
  133           return SUCCESS;
  134       }
  135   }

Home » struts-2.1.8.1-src » org.apache » struts2 » showcase » [javadoc | source]