Maybe posting the actual BeanUtils call would help. --- Andrew Hill <[EMAIL PROTECTED]> wrote: > Its wierd. Your code looks like it should work! > Ive not had time to try running it myself but really it looks ok. hmmm. > The code you pasted for TypeAbone is the entire source for that class yes? > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, 13 April 2004 23:02 > To: 'Struts Users Mailing List' > Subject: RE: Problem with BeanUtils > > > Yes I'm quite sure the object is an instance of my class TypAbonne. I added > some thing like a System.out.prinln("obj=" + obj) in my method getLibelle > and I received > [EMAIL PROTECTED] > > > I think getClass() and getBytes() are common to all java Object. > > thx in davance for help > > > -----Message d'origine----- > De : news [mailto:[EMAIL PROTECTED] la part de Bill Siggelkow > Envoye : mardi 13 avril 2004 14:05 > A : [EMAIL PROTECTED] > Objet : Re: Problem with BeanUtils > > > First of all, I assume that you are calling the getProperty method of > BeanUtils -- Are you sure that the object you are passing is an instance > of your class (TypAbonne) -- from what you indicated it sounds like it > is actually a String -- java.lang.String has two "getter" methods -- > getClass() and getBytes(). > > YOUSFI wrote: > > Hi all, > > I'm trying to use BeanUtils (I have the same problem with PropertyUtils) > to > > read dynamically a bean property. But it does not work. I think I'm > missing > > some thing very impportant. > > > > I have a bean wuith some properties(see below TypAbonne.java). > > When I pass a bean instance of this classand the string "lecode" to the > > following methode : > > > > String getLibelle(Object obj,String prop) > > { > > return BeanUtils(obj,prop); > > } > > > > I receive a NoSuchMethodException: > > When I try to debug the code I see that PropertyDescriptor array > associated > > with my class TypAbonne contains only two descriptors : one for the > property > > "class" and the other for the property "bytes" and there are no others > > descriptor for the properties "lecode" and "lelibelle". > > > > What's wrong in the code above ? > > May be my class TypAbonne should satisfy some others conditions ? > > Is it necessary to create a typAbonneBeanInfo and override the mthod > > getPropertyDescriptors ? > > Thank you a lot for your help. > > > > The exception > received ---------------------------------------------------- > > > > java.lang.NoSuchMethodException: Unknown property 'lecode' > > at > > > org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.j > > ava:1175) > > at > > > org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.j > > ava:772) > > at > > > org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:80 > > 1) > > at > > > fr.tfe.utils.tags.TFESelectTag.getLibelleSelectionne(TFESelectTag.java:122) > > at fr.tfe.utils.tags.TFESelectTag.doStartTag(TFESelectTag.java:72) > > > > > TypAbonne.java > ------------------------------------------------------------- > > - > > public class TypeAbonne implements Serializable { > > > > private String lecode = null; > > > > private String lelibelle = null; > > > > /** > > * > > */ > > public TypeAbonne() { > > } > > > > /** > > * @return > > */ > > public String getLecode() { > > return lecode; > > } > > > > /** > > * @return > > */ > > public String getLelibelle() { > > return lelibelle; > > } > > > > /** > > * @param string > > */ > > public void setLecode(String string) { > > lecode= string; > > } > > > > /** > > * @param string > > */ > > public void setLelibelle(String string) { > > lelibelle= string; > > } > > > > } >
__________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]