Perhaps you need to step through the struts-config to make sure you are referencing the correct form bean.

Do you access the .jsp page directly or go through an action first?

I would also look at your initialisation of the elementMap. Perhaps you should be using

private Properties elementMap = new Properties();

and in your reset method:

elementMap.clear()

to make sure it is initialised at first use. If you accessed the .jsp directly I don't think the reset method is called, but the bean is created.


Ray Madigan wrote:


I tried this - same result? hmmmm

-----Original Message-----
From: Jason Lea [mailto:[EMAIL PROTECTED]
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





-- Jason Lea


--------------------------------------------------------------------- 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]




--
Jason Lea


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to