You don't have any other setElementMap() methods in there do you?
eg
    public void setElementMap(String key, Object value)
    public void setElementMap(String key, String value)

There should only be 1.



Ray Madigan wrote:

Jason - thanks for your help. I do appreciate it.

This code worked in 1.1 beta and I haven't had a chance to look at it
since then. I have found that the exception I am getting is caused by
Struts via BeanUtils attempting to access a setter on a bean when the
setter method doesn't exist.

I added to the line:
private Properties elementMap = new Properties();

I rechecked the name of the methods and the name in the jsp.
I remember once I had a space between the ( and the parameter and
the parser couldn't find the parameter.

This page lives in a set of pages that all use the same formBean
it is the only page that uses the map.  Also the html text control
code lives in a tile.  The tile declares itself a form and uses the
correct form.

I'll have to dig in the source I guess.


-----Original Message----- From: Jason Lea [mailto:[EMAIL PROTECTED] Sent: Thursday, September 18, 2003 3:29 PM To: Struts Users Mailing List Subject: Re: Map Backed Form


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]


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