• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

beans instance

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1211
Mac IntelliJ IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic