Title: Map iterate problem
Or you
can define your Map from MultiMap....
(Note:
some changes made to MutiMap)
public
class MultiMap { public Map mymap = new
HashMap();
public void setValue(String key, Object
value) { values.put(key,
value); }
public Object
getValue(String key) { return
values.get(key);
} public
MultiMap() {
values.put("foo","bar");
values.put("you","me");
} public Map
getMyMap() { return
myMap; } }
then.....<bean:define id="yourMap" name="mm"
scope="application">
then
simply iterate through yourMap....Hope this works.....Vinh
Your multimap must be an instance of java.util.Map to get logic:iterate
to recognize/handle it properly.
-----Original Message----- From: Mark Ayad
[mailto:[EMAIL PROTECTED]] Sent: Tue 11/12/2002 9:17 AM
To: Struts Users Mailing List Cc: Subject:
Map iterate problem
I have a Map which I place into the Application Context
using the following line in a plugin
init:
servlet.getServletContext().setAttribute("mm", new
MultiMap());
The map is:
public class
MultiMap { public Map values = new
HashMap();
public void setValue(String key, Object
value) { values.put(key,
value); }
public Object
getValue(String key) { return
values.get(key);
} public
MultiMap() {
values.put("foo","bar");
values.put("you","me");
} public Map
getMap() { return values
; } }
In the JSP I try to iterate over this
map using (which doesn't throw any
exceptions):
<logic:iterate id="map" name="mm"
property="map"> </logic:iterate>
However When I try
to use
<bean:write name="mm" property="key"/>
I
get:
javax.servlet.jsp.JspException: No getter method for property
key of bean mm
What am I missing
?
|
<<attachment: winmail.dat>>
--
To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>