• Post Reply Bookmark Topic Watch Topic
  • New Topic

beans instance

 
Rafael Fagundes
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

Well, in a jsp page:

<jsp:useBean class="YYY.Atendimento" id="at" scope="session"/>
<jsp:useBean class="YYY.ColaboradorAtividade" id="colAtv" scope="session"/>

It is possible to make YYY.ColaboradorAtividade extend YYY.Atendimento?
I�m asking this because when I am using colAtv some at attributes are null. I�m trying to save some bd connections and avoid duplicated code. It�s possible to make this?

Thank�s for your atttention,
Rafael.
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, why not?

Avoiding duplicate code may be a good reason for subclassing, but saving DB connections probabely is not. For that you should look into DB connection pooling.

You should also research a bit on using 'composition vs. inheritence' for code reuse, often it is better to hold a reference to another object to use its functionality, rather than extend it.

Sonny
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!