struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <rye...@yahoo.com>
Subject RE: no getter method for property phoneList
Date Fri, 20 Dec 2002 21:54:51 GMT
Take a look at this page:
http://jakarta.apache.org/struts/userGuide/building_controller.html#map_action_form_classes


The problem is that you don't have methods to get the
individual items from your lists. You need methods
such as

public String getPhoneItem(int index) {
  return phoneList_.get(index)
}

public void setPhoneItem(int index, Object obj)
{
 phoneList_.set(index,obj);
}

The actual names of the methods don't really matter.

You will have to add code to the getter method so that
you won't get an ArrayIndexOutOfBounds exception when
the getter is called and the list is empty. This topic
has been discussed on the list a few times over the
last week or two.

Regards,

Richard

--- Raffy_Lata@ffic.com wrote:
> 
> I tried almost every combination. Reversing the
> order, doing just the
> addressList then the just the phoneList. Whatever
> combination I use, the
> addressList is always introspected ok while the
> phoneList isn't. I even
> tried renaming the getPhoneList() to
> getTelephoneList() and then tried to
> invoke that method with the same problem. I even
> tried copying
> getAddressList() and renamed to getPhoneList() and
> that didn't work either.
> I also tried deleting the pre-compiled jsps to make
> sure I get fresh ones
> when I bring up the jsp.
> 
> The problem, as I observed it, is when
> PropertyUtils.copyProperty (this is
> RequestUtils.lookup) is invoked to retrieve the
> bean's method and it
> couldn't find it. I traced all variables and objects
> being passed to it and
> I didn't see anything peculiar. I don't have the
> source code for the
> beanutils package so I can't trace it any farther
> than the copyProperty
> method.
> 
> It may also be how I defined my bean, but I checked
> it inside/out and
> compare it with my other classes with similar
> structure.
> 
> What I ended up doing, which is not scientific, is
> to recreate my Party
> class one attribute/one method at a time. After,
> say, creating addressList
> and it's accessors, I tested it to make sure the
> iterate tag works. Then I
> added phoneList and to my surprise, it worked. Then
> I proceeded to add all
> my other attributes/mtehods/etc. It wasted a day or
> work and I still wasn't
> able to figure out why it happened in the first
> place.
> 
> Thanks for the responses and if anybody encounters
> the same problem, which
> is really sooo weird, I'd like to find out if he/she
> ever solved it without
> doing what I did.
> 
> Thanks again.
> 
> 
> 
> 
> 
> <Greg.Reddin@alltel.com> on 12/20/2002 10:44:44 AM
> 
> Please respond to "Struts Users Mailing List"
>       <struts-user@jakarta.apache.org>
> 
> To:   <struts-user@jakarta.apache.org>
> cc:
> Subject:  RE: no getter method for property
> phoneList
> 
> 
> Here's some questions:
> 
> 1) If you reverse the order of the iterate tags,
> iterating over phoneList
> first and addressList second, do you get the same
> results?
> 
> 2) Does the address information render correctly if


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message