dcsimg
Nested hashmap properties problem?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Santa_Claus
Posted On:   Tuesday, August 9, 2005 09:07 AM

Hi everyone, I think I have a very special problem, I'm a web development beginner, so I don't even know, if this is the right forum. But it would be nice to get some help.... I've got the following code: // form class public class MyForm extends ValidatorForm { private HashMap _myGoalAccounts = new HashMap(); public HashMap getMyGoalAccounts() { return _myGoalAccounts; } public void setMyGoalAccounts(HashMap xxx) { _myGoalAccounts = xxx; } public void setMyGoalAccount(String id, MyElement goal) { _myGoalAccounts.put(id, goal); } public MyElemen   More>>

Hi everyone,



I think I have a very special problem, I'm a web development beginner, so I don't even know, if this is the right forum. But it would be nice to get some help....



I've got the following code:



			
// form class
public class MyForm extends ValidatorForm
{
private HashMap _myGoalAccounts = new HashMap();

public HashMap getMyGoalAccounts()
{
return _myGoalAccounts;
}
public void setMyGoalAccounts(HashMap xxx)
{
_myGoalAccounts = xxx;
}
public void setMyGoalAccount(String id, MyElement goal)
{
_myGoalAccounts.put(id, goal);
}
public MyElement getMyGoalAccount(String id)
{
return (MyElement)_myGoalAccounts.get(id);
}
}



The myGoalAccounts hashmap-value parameter contains elements of the fowlloing class, hashmap-key is the ID of an base account...



			
// element class
public class MyElement implements Serializable
{
private Integer _id;
private Collection _goals;
private int _amount;

// getter & setter ...
}



The map is filled like this:



			
// init action bean
for (Iterator iter = accounts().iterator(); iter.hasNext();)
{
Account account = (ContingentAccount)iter.next();
MyElement elem = new MyElement();
// ... fill elem data
myForm.setMyGoalAccount(account.getId(), elem);
}



... and the jsp:



			
// jsp page








The first call of this page gives me the right result, but wenn I want to leave the page, I get the following error:



			
ERROR - StandardWrapperValve.invoke(253) | Servlet.service() for servlet action threw exception
java.lang.IllegalArgumentException: No bean specified
at org.apache.commons.beanutils.PropertyUtilsBean.getPropertyDescriptor(PropertyUtilsBean.java:751)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:937)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
.......



Can you show me where the problem is? If I understand it right, somethings wrong with a setter method of a property .... but what?


Thanks in advance,
Moony

   <<Less
About | Sitemap | Contact