Re: struts bean utils-problems with properties

2005-10-20 Thread Aldo Vadillo Batista
Maybe it fails because types are incompatible for BeanUtils. All the same
getters and setters must return or accept the same type of Object.

2005/10/19, hem hem [EMAIL PROTECTED]:

 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 http://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.



Re: struts bean utils-problems with properties

2005-10-20 Thread hem hem
how can i resolve this mate?
is there any help from struts bean utils that do the conversion automatically?

Aldo Vadillo Batista [EMAIL PROTECTED] wrote:
Maybe it fails because types are incompatible for BeanUtils. All the same
getters and setters must return or accept the same type of Object.

2005/10/19, hem hem :

 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.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: struts bean utils-problems with properties

2005-10-20 Thread 李海
can you post the html script of your input form?

2005/10/20, hem hem [EMAIL PROTECTED]:

 how can i resolve this mate?
 is there any help from struts bean utils that do the conversion
 automatically?

 Aldo Vadillo Batista [EMAIL PROTECTED] wrote:
 Maybe it fails because types are incompatible for BeanUtils. All the same
 getters and setters must return or accept the same type of Object.

 2005/10/19, hem hem :
 
  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.namehttp://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.
 

 __
 Do You Yahoo!?
 Tired of spam? Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com



struts bean utils-problems with properties

2005-10-19 Thread hem hem
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.