Hi, I've encountered an indexed property problem (common in Struts) when navigating from one page to another if checkboxes are checked in the page that I'm navigating from:
[6/28/05 12:51:01:354 EDT] 44bb6cd5 WebGroup E SRVE0026E: [Servlet Error]-[BeanUtils.populate]: java.lang.NullPointerException at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:497) at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUt ils.java:410) at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUti ls.java(Compiled Code)) at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.jav a(Inlined Compiled Code)) at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java(Compil ed Code)) at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java(Compiled Code)) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java(Compiled Code)) at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcess or.java:779) at com.ford.focit.web.UTF8RequestProcessor.processPopulate(UTF8RequestProce ssor.java:38) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 246) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510) I think that I've found the cause of the problem but need some help with the solution. I've identified a workaround but I'd like to apply the ideal solution if one exists. Here is a description of the problem. - the page that I'm navigating from has the following code in its action form: public class ProgramBaseForm extends IsisBaseForm { /** * The program map. */ SortedMap programMap = new TreeMap(); /** * Returns the program list. * @return ProgramPTO[] */ public ProgramVO[] getProgramList() { ArrayList programList = new ArrayList(); programList.addAll(programMap.values()); return ((ProgramVO[]) programList.toArray(new ProgramVO[0])); } /** * Sets the program list. * @param programList The program list */ public void setProgramList(ProgramVO[] programList) { SortedMap map = new TreeMap(); for (int i=0; i<programList.length; i++) { ProgramVO programVO = (ProgramVO) programList[i]; map.put(new Integer(i), programVO); } this.programMap = map; } /** * Returns the program list. * @param index The index * @return ProgramPTO */ public ProgramVO getProgramList(int index) { Integer key = new Integer(index); ProgramVO programVO = (ProgramVO) this.programMap.get(key); if (programVO == null) { programVO = new ProgramVO(); this.programMap.put(key, programVO); } return programVO; } /** * Sets the program list. * @param index The index * @param program The program */ public void setProgramList(int index, ProgramVO programVO) { Integer key = new Integer(index); if (index < getProgramList().length) { this.programMap.put(key, programVO); } } - the page that I'm navigating to has the following code in its action form: public class IncentiveGridBaseForm extends IsisBaseForm { private List programList; /** * Returns the programList. * @return List */ public List getProgramList() { return programList; } /** * Sets the programList. * @param programList */ public void setProgramList(List programList) { this.programList = programList; } As you can see, the forms implement programList differently which is the cause of the problem. In order for indexed properties to work, the code in the first form is appropriate. The exception occurs because the second form uses List which does not work for indexed properties. The issue is that I did develop the first form but not the second and I believe that neither form should need to be changed to solve this problem (my workaround is to rename programList in either the first or second form, but this is not ideal). Has anyone encountered this problem before and if so, how did you solve it? Thanks in advance for your help. Regards, Christina Siena