Thanks Hans.

Performance was my biggest concern.
I'm the primary developer, and these aren't "huge" apps so I'm not worried about the 
maintainability.
Most of the people I work with on these projects know Java/Servlets, but using JSTL or 
other tag libraries have saved some time for us in the development process.

I intend to use the main "processing" code as a Servlet.
I just wanted to use JSTL for the "interface" pages.

These discussions have helped me enormously in understanding how I should progress 
with JSTL/JSP/Servlets/etc.

thank you all!

~ Troy Campano

-----Original Message-----
From: Hans Bergsten [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, October 08, 2002 10:54 PM
To: [EMAIL PROTECTED]
Subject: Re: JSTL and Connection Pooling


Joseph Ottinger wrote:
 > Hans, I fully agree in that there are more than one side -- but I'd  > still stand 
 >by my statement to Troy, with a caveat in place.  >  > I have NO problem with Hans 
 >Bergsten, or Shawn Bayern, or James  > Strachan, etc., using the SQL tags. An expert 
 >can bend or break the  > rules, and generally does so when the situation calls for it 
 >- and  > because of expertise, you're generally sure that it's been done with  > 
 >logic and reason behind it. I've done the same myself. That said, I  > don't think 
 >someone who's willing to wonder if it should be done  > should do so, because the 
 >wonderment itself shows a lack of enough  > knowledge to make a correct choice. (I'm 
 >really not trying to be  > insulting to those who wonder - I mean, you have to start 
 >questioning  > methods SOMEWHERE. But let's pretend I'm speaking VERY generally,  > 
 >with the understanding that whoever's reading this is an obvious  > exception.)  >  > 
 >That's really my problem with the JSTL having SQL tags - instead of  > them being a 
 >tool chosen deliberately, they are being "blessed" by  > virtue of the JSTL mantle 
 >into being a commonly acceptable tool. I'm  > sorry; I realise JSP is fully able to 
 >serve as controller, model,  > *and* view, but I would hope that by now we'd realise 
 >that the first  > two roles aren't what it's suited for, and encouraging it in those  
 >> roles is counterproductive.

I don't want to start a long debate about this (I think the thread I pointed to covers 
it pertty well), but I'll add one comment and try to answer Troy's follow-up questions 
at the same time.

Troy, the main reason many consider it bad practice to include database access in a 
JSP page has nothing to do with performance, no matter if you use the JSTL SQL actions 
or some other approach. It's all about design and using appropriate abstractions to 
make the application easier to maintain. If you include SQL in your JSP pages, you 
expose the database schema in a part of the application that should not know these 
details (the View in the MVC pattern). Or, a similar argument, your using a technology 
(JSP) that is primarily intended for the View (user interface) part of the application.

I agree with Joseph that you should be aware of the drawbacks (an application that may 
be hard to maintain and extend), but I still think including SQL actions in JSTL was 
the right choice. If we didn't, people who are not programmers but still like to use 
JSP to develop a simple application would either use Java scriptlets with raw JDBC 
code (and we've all seen the catastrophic results of a non-programmer doing this), use 
one of the many third-party SQL custom tag libraries that are available (better), or 
give up on using JSP altogether (sad); they would _not_ learn OO design, how to 
program in Java, develop DAO, beans and servlets. Isn't it better then to offer a 
simple set of standard JSP actions that they can use?

If you're enough of a Java programmer to know how to develop servlets etc. you're 
hopefully also experienced enough to understand what can be gained from using a more 
structured design, and you can make an educated decision about whether to use or stay 
away from the JSTL SQL actions. If not, your hopefully taking your job seriously 
enough to read up on these things before you start hacking (and any good book or 
article point out the pros and cons; at least mine do ;-).

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For 
digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some 
relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to