• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:useBean with type

 
Tony suankularb
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assume Employee extends Person

<jsp:useBean id="person" type="foo.Person" class="foo.Employee" scope="page">

I understand that if person object does NOT exist, a bean object would be created using the reference type.
like this

foo.Person person= new foo.Employee()


What if the bean object already exist, will it assign the type "foo.Person" to the existing object?
 
Vijitha Kumara
Bartender
Pie
Posts: 3930
21
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony suankularb wrote:<jsp:useBean id="person" type="foo.Person" class="foo.Employee" scope="page">
What if the bean object already exist, will it assign the type "foo.Person" to the existing object?

It'll first check the availability of the bean in the given scope anyway. If exists it will be be assigned to the reference.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic