• 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

Why DB connections are not written directly in JSPs ?

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Reasons :
a)Response is slow
b) Not a standard J2EE architecture
c) Load Balancing is not possible

Which one is correct ?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lavjeet,
Whenever someone enters multiple choice questions into a forum, my first assumption is that they have copied and pasted from a homework assignment.

Which do you think it is?
Why?
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think it's homework, I mean, what with a 95% on the SCJP!
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like homework to me too... but I will give it a shot anyway.

I tend to learn toward the fact that it is not standard J2EE architecture. I am a MVC Model 2 advocate, and I maintain that a JSP should only be used as the view. The place for database logic is in the model. Also, let's remember that we should be using database connection pooling in a J2EE application anyway.

As far as the other two... Is the response slower if you code a database connection directly into the JSP? I doubt it because all JSPs are compiled into a servlet anyway, so they should be executed just as quickly (with the exception of thefirst time of course). I could be wrong though... if someone knows differently, I would be interested in their thoughts.

And what does load balancing have to do with it? I fail to see how distributing processing and communications activity evenly across a computer network will no longer be possible just because you put a database connection into a JSP...
[ November 22, 2005: Message edited by: Paul Bourdeaux ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic