Lavjeet, Whenever someone enters multiple choice questions into a forum, my first assumption is that they have copied and pasted from a homework assignment.
I don't think it's homework, I mean, what with a 95% on the SCJP!
There is no emoticon for what I am feeling!
Paul Bourdeaux
Ranch Hand
Joined: May 24, 2004
Posts: 783
posted
0
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 ]
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Why DB connections are not written directly in JSPs ?