• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cannot find getter method ....

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following:
<td>
<logic:iterate name="currentUser" id="tel" property="telephoneNumbers" indexId="index">
<html:text name="tel" property="telephoneNumber" indexed="true" size="20"/>
</logic:iterate>
<!-- THIS LINE WORKS AND IT PRINTS VECTOR CONTENTS -->
<html:text name="currentUser" property="telephoneNumbers" size="20"/>
</td>
As result, I am getting:
No getter method for property telephoneNumbers of bean tel
I can't figure out which getter/setter and where I need to have. I put indexed getter/setters into the same bean where Vector telephoneNumbers is, for String telephoneNumber. Also, i put getter/setter (same) into Action Form... still same error.
Anybody can provide any hints?
Thanks a million
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will tell you that everytime I get that error, when I track it down, I want to kick myself in the pants. I would change the names of your vars to something completely different so that it will be easier to find. When you are trying to find telephoneNumbers and telephoneNumber it can be a pain because they are so close. I'd give that a try.
 
sergio
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as variables concerned, I don't think I am confused. 'telephoneNumbers' is a vector property - I can get it via html:text... or bean:write
'String telephoneNumber' has indexed getter/setter methods which get/set above-mentioned Vector elements.
The thing is that both 'Vector telephoneNumbers' and 'String telephoneNumber' with all their getter/setter methods are in the same bean object. I also added identical methods into 'ActionForm' class but could set anything for this property, of course, yet.
I can print the Vector property via <bean:write name="tel"/> without 'property' attribute, because it's not a bean. But I need to to iterate over each its vector element and show it in its own, indexed text form field.
However, it looks like <html:text.../> needs a 'property=...' attribute (required!), but what should my "tel" object be in this case? I am using 'telephoneNumber' String property in the same bean object (where 'telephoneNumbers' is found)! Is it gonna work? It doesn't really make sense to create a totally separate bean object just to hold a single phone number to be kept in the Vector 'telephoneNumbers' to be able to use <html:text name="tel" property="telephoneNumber" indexed="true"/>
Could it be that because it's the same bean, I am getting an error about Collection (telephoneNumbers) property (which is accessible otherwise), because <html:text.../> is getting confused?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sergio,
the "name" attribute of logic iterate tag should correspond to your action form (currentUser, in this case, which extends ActionForm). The "property" attribute will corresponds to a collection in your currentUser object.
so somewhere in your currentUser you must have telephoneNumbers variable, which is a collection.
and you must have getter and setter for this variable, which will look like :
public void setTelephoneNumbers(integer index, String number){
telephoneNumbers.add(index,number)
}
(if you want to fill the collection with string object, if not, change accordingly )
public String getTelephoneNumber(index){
return (String)telephoneNumbers.get(index);
}
<logic:iterate name="currentUser" id="tel" property="telephoneNumbers" indexId="index">

rgds
beN
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic