You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael McGrady <mi...@michaelmcgrady.com> on 2004/04/24 17:24:08 UTC

Mapped Properties Difficulty

I have a bean class that has a map field in which I store a map of a second 
bean class which also has a map field in which I store strings.

public class BeanOne {
   Map beanTwoMap;

   public void setBeanTwo(Object beanTwoName, Object beanTwo) {
     if(map == null) {
       // create map beanTwoMap
       beanTwoMap.put(beanTwoName, beanTwo);
   }
   public Object getBeanTwo(Object beanTwoName) {
     return beanTwoMap.get(beanTwoName);
   }
}

pubic class BeanTwo {
   Map stringMap;

   public void setString(Object stringName, Object string) {
     if(map == null) {
       // create map stringMap
       stringMap.put(stringName, string);
   }
   public Object getString(Object stringName) {
     return stringMap.get(stringName);
   }
}

The difficulty I have is in extracting the maps.  Do I have to use nested 
tags?  Do I have to use getMap(someMapName)?  Help?  If someone has a 
standard solution to this, it needs to be on the list.  So far as I can 
see, it is not.  Generally, the documentation for nesting is a bit 
dark.  Thanks for any help here.

Michael