struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dean, Michael" <Michael.D...@courts.wa.gov>
Subject RE: Problem with map-based property in ActionForm
Date Fri, 21 Jul 2006 23:25:10 GMT
Scott: 

See: http://struts.apache.org/1.2.9/faqs/indexedprops.html

I think it remains for you to provide a method a la:

 public Object getKey(String key) {
 return values.get(key);
} 

Regards,
M

-----Original Message-----
From: Scott Van Wart [mailto:scott@indosoft.com] 
Sent: Friday, July 21, 2006 2:54 PM
To: Struts Users Mailing List
Subject: Problem with map-based property in ActionForm

I have an action form defined like this:

public MyForm extends ActionForm {
  private Map<String, String> values = new TreeMap<String, String>();
  public Map<String, String> getValues() { return this.values; }
  public Set<String> getKeys() { return this.values.keySet(); }
}

  and in my JSP,

<c:forEach item="key" items="${myForm.keys}">
  <html:multibox property="values(${key})" 
value="first">First</html:multibox>
  <html:multibox property="values(${key})" 
value="second">Second</html:multibox>
  <!-- ... -->
</c:forEach>

When I access the page, I get the following error:

"No getter method available for property permissions(1) for bean under 
name org.apache.struts.taglib.html.BEAN"

  Is this the right way to access map properties in a bean?  Any ideas?

Thanks,
  Scott

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


Mime
View raw message