commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hem hem <hemanth3...@yahoo.com>
Subject struts bean utils-problems with properties
Date Thu, 20 Oct 2005 07:29:56 GMT
Hi all,
i am new to this forum.this is my first post.i hope this mailing list helps me.
 
in the first page in my struts web app, i need to enter the details of 5 persons.
they have proprties name,sex,rollnumber and age
for that i created a bean with these 4 properties which have getter and setter methods in
it.
then i instantiated the bean 5 times for the properties of 5 persons
the bean name is person
in my action form i instatiated like this:
Person person1=new Person();
Person person2=new Person();
Person person3=new Person(); and so on
in my jsp i used the property names as person1.name,person1.sex like that.
 
so far its ok
but i need to populate the model objects from this form.
for that 
i used apache commons beanutils as below:
PersonModel is exactly the same bean as my Person bean with exactly the same properties and
same getter and setter methods.
but the datatypes of properties in PersonModel are diffrent from Person bean(all the properties
are Strings in Person but 2 are Strings,1Long,1int in PersonModel)
PersonModel  person1Model=new PersonModel ();
 
BeanUtils.copyProperties(person1Model,personForm.getPerson1());
 
but this is failing to copy the properties and throwing illegalargumentexception.
 
can anyone help how can i achieve this(copying properties)
it seems to be nested property problem.i am new to struts.
 
your suggestion are very much appreciated.
 
regards and thanks in advance




		
---------------------------------
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message