struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piero Sartini <li...@pierosartini.de>
Subject Re: How do you provide a Map from the application scope for the list of a s:select
Date Thu, 15 Mar 2007 17:15:48 GMT
It just testing-code and does not make much sense. but here we go.
I had a list before .. so the map is constructed from the list.

--- code ---
    public static List<String> countryCodes = new ArrayList<String>(
            Arrays.asList(
            "de", "en", "it"
            ));
    
    public static Map<String,String> countryMap = null;
    
    public static Map getCountryMap() {
        if (countryMap == null) {
            countryMap = new HashMap<String,String>();
            for (String s : countryCodes) {
                countryMap.put(s,s);
            }
        }
        return countryMap;
    }
--- code ---

Am Donnerstag, 15. März 2007 schrieb Dave Newton:
> --- Piero Sartini <lists@pierosartini.de> wrote:
> > Am Donnerstag, 15. März 2007 schrieb Dave Newton:
> > > --- Piero Sartini wrote:
> > > >         return Constants.getCountryMap();
> > >
> > > What does Constants.getCountryMap() return?
> >
> > the map looks like:
> > {de=de, it=it, en=en}
>
> No, I want the actual code for the map's construction
> and retrieval method, because so far I have no idea
> why it wouldn't work.
>
> d.
>
>
>
>
> ___________________________________________________________________________
>_________ TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.
> http://tv.yahoo.com/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org

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


Mime
View raw message