commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Moseley <...@covalent.net>
Subject [beanutils] setProperty problem with indexed nested property
Date Wed, 19 Feb 2003 21:02:43 GMT

[i posted a similar message to the struts-user list yesterday and 
haven't received a response. i'm posting this one to commons-user since 
it's more likely that the problem is how i'm constructing my property 
name anyway.]

i'm having a problem with a struts ActionForm that has several indexed 
nested properties. when i submit the html page and struts attempts to 
populate the form from the request, BeanUtils.setProperty (or something 
it calls) barfs. i can't tell what the problem is because something is 
annoyingly swallowing the exception.

setProperty is apparently being called with these parameters: 
<PlatformForm instance>, "ip[0].address", <empty String[]> - at least 
that's how it appears to me from examining the log output (below) and 
the trace logging code in setProperty.

i expected that the section of code beginning at line 836 ("//resolve 
any nested expression to get to the actual target bean") would have 
logged "Target bean = ip[0]" and "Target name = address", but that's not 
occurring.

what could i be doing wrong?

the form bean class looks like this (trimmed for brevity):

public class PlatformForm extends ActionForm  {

     private List ip;

     public List getIp() {
	return this.ip;
     }

     public void setIp(List ip) {
         this.ip = ip;
     }

the html that is generated by struts looks like this (also trimmed for 
brevity):

   <tr>
     <td><input type="text" name="ip[0].address" size="30" value=""></td>
     <td><input type="text" name="ip[0].netmask" size="30" value=""></td>
   </tr>

the log file contains this output:

bcm@shrike:~/work/cov/src> 12:30:51,850 INFO  [RequestProcessor] 
Processing a 'POST' for path '/resource/platform/inventory/NewPlatform'
12:30:51,851 DEBUG [RequestProcessor]  Storing ActionForm bean instance 
in scope 'request' under attribute key 'NewPlatformForm'
12:30:51,851 DEBUG [RequestProcessor]  Populating bean properties from 
this request
12:30:51,851 DEBUG [BeanUtils] BeanUtils.populate(startTime=now 
startMonth=null startDay=null startYear=null startHour=00 startMin=00 
startAmPm=am startTimeZone=PST recurInterval=null 
recurrenceFrequencyDaily=everyDay numDays=1 numWeeks=1 
recurrenceDay=[Ljava.lang.Integer;@d11b79 
recurrenceFrequencyMonthly=onDay numMonths=1 recurrenceWeek=null 
eachDay=null endTime=none endMonth=null endDay=null rid=null type=null 
name=null location=null description=null  cpuCount=null cpuSpeed=null 
dhcpServer=null dnsServer=null fqdn=null gateway=null ram=null ip=[], 
{ok.y=[Ljava.lang.String;@62b333, gateway=[Ljava.lang.String;@e2f8c1, 
ip[0].address=[Ljava.lang.String;@3954b1, 
ip[0].MACAddress=[Ljava.lang.String;@e746a2, 
cpuCount=[Ljava.lang.String;@ce56f8, 
dnsServer=[Ljava.lang.String;@afbbe3, 
description=[Ljava.lang.String;@584e97, 
resourceType=[Ljava.lang.String;@8fc7ca, 
ok.x=[Ljava.lang.String;@85bf5f, ram=[Ljava.lang.String;@d733ca, 
location=[Ljava.lang.String;@891d76, 
dhcpServer=[Ljava.lang.String;@ed4d06, fqdn=[Ljava.lang.String;@5bece2, 
name=[Ljava.lang.String;@1cf4e5, cpuSpeed=[Ljava.lang.String;@121e5a, 
ip[0].netmask=[Ljava.lang.String;@86aad9})
12:30:51,851 DEBUG [BeanUtils]   setProperty(startTime=now 
startMonth=null startDay=null startYear=null startHour=00 startMin=00 
startAmPm=am startTimeZone=PST recurInterval=null 
recurrenceFrequencyDaily=everyDay numDays=1 numWeeks=1 
recurrenceDay=[Ljava.lang.Integer;@d11b79 
recurrenceFrequencyMonthly=onDay numMonths=1 recurrenceWeek=null 
eachDay=null endTime=none endMonth=null endDay=null rid=null type=null 
name=null location=null description=null  cpuCount=null cpuSpeed=null 
dhcpServer=null dnsServer=null fqdn=null gateway=null ram=null ip=[], 
ok.y, [16])
12:30:51,852 DEBUG [BeanUtils]     Target bean = false
12:30:51,852 DEBUG [BeanUtils]     Target name = y
12:30:51,852 DEBUG [BeanUtils]   setProperty(startTime=now 
startMonth=null startDay=null startYear=null startHour=00 startMin=00 
startAmPm=am startTimeZone=PST recurInterval=null 
recurrenceFrequencyDaily=everyDay numDays=1 numWeeks=1 
recurrenceDay=[Ljava.lang.Integer;@d11b79 
recurrenceFrequencyMonthly=onDay numMonths=1 recurrenceWeek=null 
eachDay=null endTime=none endMonth=null endDay=null rid=null type=null 
name=null location=null description=null  cpuCount=null cpuSpeed=null 
dhcpServer=null dnsServer=null fqdn=null gateway=null ram=null ip=[], 
gateway, [])
12:30:51,852 DEBUG [ConvertUtils] Convert string '' to class 
'java.lang.String'
12:30:51,852 DEBUG [ConvertUtils]   Using converter 
org.apache.commons.beanutils.converters.StringConverter@be8216
12:30:51,852 DEBUG [BeanUtils]   setProperty(startTime=now 
startMonth=null startDay=null startYear=null startHour=00 startMin=00 
startAmPm=am startTimeZone=PST recurInterval=null 
recurrenceFrequencyDaily=everyDay numDays=1 numWeeks=1 
recurrenceDay=[Ljava.lang.Integer;@d11b79 
recurrenceFrequencyMonthly=onDay numMonths=1 recurrenceWeek=null 
eachDay=null endTime=none endMonth=null endDay=null rid=null type=null 
name=null location=null description=null  cpuCount=null cpuSpeed=null 
dhcpServer=null dnsServer=null fqdn=null gateway= ram=null ip=[], 
ip[0].address, [])


Mime
View raw message