struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ray Madigan" <...@madigans.org>
Subject RE: Map Backed Form
Date Thu, 18 Sep 2003 21:45:10 GMT
I tried this - same result? hmmmm

-----Original Message-----
From: Jason Lea [mailto:jason@kumachan.net.nz]
Sent: Thursday, September 18, 2003 2:18 PM
To: Struts Users Mailing List
Subject: Re: Map Backed Form


I read this somewhere (perhaps Struts in Action) and I use map-backed
properties... the methods should have String keys, but Object values eg

public Object getElementMap ( String key ) {
public void setElementMap ( String key, Object value )


Ray Madigan wrote:

> I am having some difficulty with my Map Backed Form implementation.
>
> I have in my Form:
>
> private Properties elementMap = null;
>
> public String getElementMap ( String key ) {
>     return ( String ) elementMap.getProperty ( key );
> }
>
> public void setElementMap ( String key, String value ) {
>     elementMap.put ( key, value );
> }
>
> public void reset ( ActionMapping mapping, HttpServletRequest request ) {
>     ...
>     elementMap = new Properties ( );
> }
>
> I have in my JSP:
>
> <html-el:text property='elementMap(${element.element})'
> value='${element.value}'/>
>
> If I enumerate the request parameters in the reset method of the form
> the paramaters and values look like:
>
> name->elementMap(PerPage)
> value->4
>
> I get the exception
> java.lang.IllegalAccessError: try to access class
> org.apache.commons.beanutils.MappedPropertyDescriptor$1 from class
> org.apache.commons.beanutils.MappedPropertyDescriptor
>
>>>From past experience I get this exception when struts is looking for a
> setter
> in my form and can't find it.  I think that struts is looking for a method
> 'setElementMap(perPage)' and has not figured out it is a mapped property
> for some reason.  And I can't write a method with name.
>
> Any help would be appreciated.
>
> Thanks
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>


--
Jason Lea


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


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


Mime
View raw message