You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Michael Duffy <du...@yahoo.com> on 2003/06/06 20:46:22 UTC

Example use of java.servlet.jsp.jstl.sql.dataSource?

In Chapter 14 of Shawn Bayern's "JSTL In Action", he
talks about setting up a default data source for JSTL.
 He shows how to add <context-param> tags to the
web.xml deployment descriptor on page 352, and below
that says the parameter name for the default data
source is javax.servlet.jsp.jstl.sql.dataSource.

But he doesn't show an example of how to use it in the
JSP.

Forgive me for being dense, but does anyone have an
example of what this should look like?  I've got this
for a web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC
    "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    
    <display-name>Data Source Tester</display-name>
    <description>Data Source Tester</description>
    
    <context-param>
        <param-name>
javax.servlet.jsp.jstl.sql.dataSource
        </param-name>
        <param-value>
java:comp/env/jdbc/Conference
        </param-value>
    </context-param>
        
    <resource-ref>
        <description>Conference Data</description>
        <res-ref-name>jdbc/Conference</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

</web-app>

What is the name of the default data source in this
case?  Is it

<sql.setDataSource
dataSource="javax.servlet.jsp.jstl.sql.dataSource"/> ?



Thanks - MOD


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Example use of java.servlet.jsp.jstl.sql.dataSource?

Posted by Michael Duffy <du...@yahoo.com>.
Oh!  That never occurred to me.

Are the <context-param> tags that I added to my
web.xml correct? 

Thanks again for your expert advice, Shawn. - MOD


--- Shawn Bayern <ba...@essentially.net> wrote:
> On Fri, 6 Jun 2003, Michael Duffy wrote:
> 
> > In Chapter 14 of Shawn Bayern's "JSTL In Action",
> he talks about
> > setting up a default data source for JSTL.
> >  He shows how to add <context-param> tags to the
> web.xml deployment
> > descriptor on page 352, and below that says the
> parameter name for the
> > default data source is
> javax.servlet.jsp.jstl.sql.dataSource.
> > 
> > But he doesn't show an example of how to use it in
> the JSP.
> 
> In the JSP pages, JSTL tags will automatically sense
> the default
> DataSource that you have established and will
> acquire connections from it
> as necessary.  When you set a default, you don't
> need to use the
> <sql:setDataSource> tag at all; this tag is useful
> only in cases where you
> haven't established (or want to override) the
> default.
> 
> -- 
> Shawn Bayern
> "JSTL in Action"   http://www.manning.com/bayern
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> taglibs-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Example use of java.servlet.jsp.jstl.sql.dataSource?

Posted by Shawn Bayern <ba...@essentially.net>.
On Fri, 6 Jun 2003, Michael Duffy wrote:

> In Chapter 14 of Shawn Bayern's "JSTL In Action", he talks about
> setting up a default data source for JSTL.
>  He shows how to add <context-param> tags to the web.xml deployment
> descriptor on page 352, and below that says the parameter name for the
> default data source is javax.servlet.jsp.jstl.sql.dataSource.
> 
> But he doesn't show an example of how to use it in the JSP.

In the JSP pages, JSTL tags will automatically sense the default
DataSource that you have established and will acquire connections from it
as necessary.  When you set a default, you don't need to use the
<sql:setDataSource> tag at all; this tag is useful only in cases where you
haven't established (or want to override) the default.

-- 
Shawn Bayern
"JSTL in Action"   http://www.manning.com/bayern


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org