import java.util.Collections; import java.util.HashMap; import java.util.Map;
public class Page { private Map keys;
public Page() { int size = 89; this.keys = Collections.synchronizedMap(new HashMap(size)); }
public void setMap(Map keys) { this.keys = keys; }
public Map getMap() { return keys; }
public void setValue(Object key, Object value) { keys.put(key,value); }
public Object getValue(Object key) { Object value = keys.get(key); if(value == null) { return "? [" + (String)key + "] ?"; } else { return value; } } } ///;-) Michael McGrady
At 04:22 PM 4/21/2004, Niall Pemberton wrote:
Haven't done this but either your class needs to be a Map implementation or you need getter/setter for your Map
public void setMyMap(Map myMap) public Map getMyMap()
The problem with using the <html> tags and not having your Map as a property of the ActionForm is that when the form is submitted, Struts is going to try to populate these properties in the form.
Niall
----- Original Message ----- From: "Michael McGrady" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, April 21, 2004 11:50 PM Subject: Re: Non-Form Based Mapped Properties
> I created a simple class with the map and setValue(Object key, Object > value) as well as getValue(Object key). Then tested the class by putting > an instance of the class into session scope on a page, retrieving the > object on the same page, and trying to access the properties via the mapped > properties value("keyName"). I made sure the object was obtained via the > logic tag, but the mapped property does not work for me. Any ideas? If > not, I will put the whole thing into this exchange. > > Thanks. > > Michael > > At 08:56 AM 4/21/2004, Bill Siggelkow wrote: > >Michael McGrady wrote: > >>Is there a way to use non-form based mapped and indexed properties with > >>bean and/or html tags? Apparently not? > > > >Yes -- you can used both mapped and indexed properties from normal > >JavaBeans. You can be more specific on the problem you are having? > > > >Bill Siggelkow > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]