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.



>From: Hans Bergsten <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: JSTL and Connection Pooling
>Date: Tue, 8 Oct 2002 13:57:49 -0700
>
>Joseph Ottinger wrote:
>>Troy, I'd suggest you not use the JSTL SQL tags, ever, because that embeds
>>activity into your JSP that really, desperately shouldn't be there. It's
>>one
>>thing to do so in a hacked-together app that has a short lifecycle or is
>>understandably and vibrantly underarchitected, but to do so in a
>>production
>>application is... a scary thought.
>>
>>SQL tags are the sort of thing I'd really hoped the JSTL would have
>>avoided.
>
>This is an interesting subject with more than one side to it. For some
>pros and cons with both sides, see a discussion about this very subject
>that took place on the Taglibs-User mailing list earlier this year:
>
>   <http://marc.theaimsgroup.com/?t=102348721000002&r=1&w=2>
>
>Hans
>
>>
>>>From: "Campano, Troy" <[EMAIL PROTECTED]>
>>>Reply-To: A mailing list about Java Server Pages specification and
>>>reference <[EMAIL PROTECTED]>
>>>To: [EMAIL PROTECTED]
>>>Subject: JSTL and Connection Pooling
>>>Date: Mon, 7 Oct 2002 15:55:11 -0400
>>>
>>>         Hello,
>>>I am having a problem trying to figure out JSTL with connection pooling.
>>>I am using Tomcat. I understand that <sql:setDataSource> can't handle
>>>connection pooling.
>>>
>>>
>>>         So I create a datasource the way I always do without JSTL (using
>>>JNDI).
>>>I'm having a problem passing that connection to <sql:query>
>>>I don't know how to use variables in the tags.
>>>
>>>         My datasource is called 'ds', but I don't know how to use it
>>>with
>>>sql:query.
>>>
>>>         pageScope.ds doesn't work.
>>>
>>>         I'm a complete JSTL newbie and totally confused.
>>>
>>>
>>>         Does anyone have any ideas?
>>>
>>>         Below is the code
>>>
>>>
>>>         thank you for the help!
>>>
>>>
>>>         Troy Campano
>>>
>>>
>>>         ------------------------- CODE HERE
>>>-----------------------------------------
>>>
>>>
>>>         <%@ page contentType="text/html; charset=iso-8859-1"
>>>language="java"
>>>import="java.sql.*,javax.sql.*,oracle.jdbc.pool.*,javax.naming.*,java.io.*"
>>>
>>>%>
>>>
>>>         <%@ taglib prefix="mt"
>>>uri="http://jakarta.apache.org/taglibs/mailer-1.0
>>><http://jakarta.apache.org/taglibs/mailer-1.0> " %>
>>><%@ taglib prefix="c"   uri="http://java.sun.com/jstl/core
>>><http://java.sun.com/jstl/core> " %>
>>><%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql
>>><http://java.sun.com/jstl/sql> " %>
>>>Step 1: Starting Page<br>
>>><br>
>>>Step 2: Creating a list of groups to get the report
>>>
>>>
>>>
>>>         <%
>>>Connection conn = null;
>>>try
>>>{
>>>//**************************************************************************
>>>
>>>***********************
>>>// Request Connection from Connection Pool
>>>//**************************************************************************
>>>
>>>***********************
>>>Context initContext = new InitialContext();
>>>Context envContext  = (Context) initContext.lookup("java:/comp/env");
>>>DataSource ds = (DataSource) envContext.lookup("jdbc/ReportManagerPool");
>>>conn = ds.getConnection();
>>>//**************************************************************************
>>>
>>>***********************
>>>%>
>>>
>>>
>>>
>>>
>>>
>>>         <sql:query dataSource="${pageScope.ds}" var="myresultset"
>>>sql="SELECT table_name FROM all_tables" />
>>>
>>>
>>>
>>>
>>>         <%
>>>}
>>>catch(SQLException e)
>>>{
>>>  throw new SQLException(e.getMessage());
>>>}
>>>
>>>           finally
>>>   {
>>>     if (conn != null)
>>>         {
>>>       try
>>>           {
>>>         conn.close();
>>>       }
>>>           catch (SQLException e)
>>>           {
>>>           // Nothing coherent to do here.
>>>           // Pray nothing else goes wrong.
>>>           e.printStackTrace();
>>>       }
>>>         }
>>>   }
>>>%>
>>>
>>>===========================================================================
>>>
>>>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
>>
>>
>>
>>-----------------------------------------------
>>Joseph B. Ottinger       [EMAIL PROTECTED]
>>http://enigmastation.com          IT Consultant
>>
>>_________________________________________________________________
>>MSN Photos is the easiest way to share and print your photos:
>>http://photos.msn.com/support/worldwide.aspx
>>
>>===========================================================================
>>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
>>
>
>--
>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


-----------------------------------------------
Joseph B. Ottinger       [EMAIL PROTECTED]
http://enigmastation.com          IT Consultant

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

===========================================================================
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