Well, oddly enough, when I changed: private List employeeWorkDay= new ArrayList(); to: private ArrayList employeeWorkDay= new ArrayList();
in my FormBean, it worked. It appears that List was the problem. Very odd. Thank you!
From: Mark Lowe <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Subject: Re: Problem with Java 1.4 and BeanUtils and maybe PropertyUtils... Date: Mon, 5 Jan 2004 18:51:31 +0100
I haven't had any of these sorts of problems even when moving struts app from 1.3 to 1.4 (i generally just follow what apple provide on osx and then just match it on linux for live servers and such like.
What i can tell you though it that I've used <c:set .. in the same way as you're using bean define and works just great.
<c:set var="idWorkDay" value="${day.workDay}" />
I tend to keep this sort of thing out of my jsp's, but looking at the way you seem to code jsp I think you'd really like jstl. And it defiantly works with 1.4.
Hope this helps
Mark
On 5 Jan 2004, at 18:37, Brad Harris wrote:
Hello, I will do my best to explain what's going on and hopefully someone can help me out. If more information is needed, please let me know.
Here is the situation. We're upgrading our servers to user java 1.4.1. We were previously running 1.3 A few of our web pages loop through collections and the user can modify something in the collection then save the changes. In 1.3 everything worked fine, no problems. However, when I switched to 1.4.1 (and tried 1.4.2) we started getting this error. I've tracked it down to this line in the PropertyUtils.java class:
-----------
if(descriptor instanceof IndexedPropertyDescriptor)
-----------
In 1.3 this was true. In 1.4 this returns false, and things go downhill from there.
Please, any help would be terrific. Thank you.
Code snippets & error are below:
.jsp page w/code:
<% int counter = 0; %>
<logic:iterate id="day" name="manualadjemplform" property="employeeWorkDay">
<bean:define id="idWorkDay" name="day" property="workDay" type="java.lang.String"/>
<bean:define id="idCases" name="day" property="cases" type="java.lang.String"/>
<bean:define id="idManualAdjId" name="day" property="manualAdjId" type="java.lang.String"/>
<% String baseProperty = "employeeWorkDay[" + (counter++) + "]";
String workDayProperty = baseProperty + ".workDay"; String commentProperty = baseProperty + ".comment"; String manualAdjIdProperty = baseProperty + ".manualAdjId"; %>
<tr>
<td align="left" nowrap>
<bean:write name="day" property="workDay"/>
<html:hidden name="day" property="<%=workDayProperty%>" value="<%=idWorkDay.toString()%>">
<bean:write name="day" property="workDay"/>
</html:hidden>
</td>
<td align="left" nowrap>
<html:text name="day" property="<%=casesProperty%>" value="<%=idCases.toString()%>" size="6" maxlength="6">
<logic:present name="day" property="cases">
<bean:write name="day" property="cases"/>
</logic:present>
<logic:notPresent name="day" property="cases">
 
</logic:notPresent>
</html:text>
</td>
<html:hidden name="day" property="<%=manualAdjIdProperty%>" value="<%=idManualAdjId.toString()%>">
<bean:write name="day" property="manualAdjId"/>
</html:hidden>
</tr>
</logic:iterate>
.jsp page rendered:
<tr>
<td align="left" nowrap>
Sunday
<input type="hidden" name="employeeWorkDay[0].workDay" value="Sunday">
</td>
<td align="left" nowrap>
<input type="text" name="employeeWorkDay[0].cases" maxlength="6" size="6" value="25">
</td>
<input type="hidden" name="employeeWorkDay[0].manualAdjId" value="2203.0">
</tr>
<tr>
<td align="left" nowrap>
Monday
<input type="hidden" name="employeeWorkDay[1].workDay" value="Monday">
</td>
<td align="left" nowrap>
<input type="text" name="employeeWorkDay[1].cases" maxlength="6" size="6" value="">
</td>
<input type="hidden" name="employeeWorkDay[1].manualAdjId" value=" ">
</tr>
FormBean: public class ManualAdjustmentEmployeeFormBean extends FormBean { private List employeeWorkDay= new ArrayList();
public void reset() { this.employeeWorkDay = new ArrayList(); }
public List getEmployeeWorkDay() { return employeeWorkDay; }
public void setEmployeeWorkDay(List employeeWorkDay) { this.employeeWorkDay = employeeWorkDay; }
public ManualAdjustmentEmployeeVO getEmployeeWorkDay(int index) {
while(index >=this.employeeWorkDay.size() ){
this.employeeWorkDay.add(new ManualAdjustmentEmployeeVO());
}
return (ManualAdjustmentEmployeeVO) this.employeeWorkDay.get(index);
}
}
Error: javax.servlet.ServletException: BeanUtils.populate
----- Root Cause -----
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.java:586)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyU tils.java:474)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUt ils.java:883)
at org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.ja va:917)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java: 1005)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:919)
at com.ciber.arch.util.RequestUtils.populate(RequestUtils.java:513)
at com.ciber.arch.web.ArchServlet.process(ArchServlet.java:190)
at com.ciber.arch.web.ArchServlet.doPost(ArchServlet.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic ationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil terChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal ve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal ve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.j ava:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav a:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV alve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav a:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 469)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve .java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor. java:1040)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java :1151)
at java.lang.Thread.run(Thread.java:534)
11:06:30,588 - [ERROR] localhost.Engine
StandardWrapperValve[controller]: Servlet.service() for servlet controller threw exception
javax.servlet.ServletException: BeanUtils.populate
at com.ciber.arch.util.RequestUtils.populate(RequestUtils.java:518)
at com.ciber.arch.web.ArchServlet.process(ArchServlet.java:190)
at com.ciber.arch.web.ArchServlet.doPost(ArchServlet.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic ationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil terChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal ve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal ve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.j ava:246)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 2396)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav a:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherV alve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav a:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 469)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve .java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor. java:1040)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java :1151)
at java.lang.Thread.run(Thread.java:534)
_________________________________________________________________
Have fun customizing MSN Messenger — learn how here! http://www.msnmessenger-download.com/tracking/reach_customize
--------------------------------------------------------------------- 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]
_________________________________________________________________
Check your PC for viruses with the FREE McAfee online computer scan. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]