• 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
Posts: 3953
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.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!