You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Henning von Bargen <H....@Triestram-Partner.de> on 2000/04/04 11:34:22 UTC

HowTo: SQL taglib

I heard talking about the sql taglib, but could not find any documentation
or example.
Is there a simple example or documentation source anywhere?
Thanks in advance
Henning

Re: HowTo: SQL taglib

Posted by Brian P Millett <bp...@ec-group.com>.
Henning von Bargen wrote:

> I heard talking about the sql taglib, but could not find any documentation
> or example.
> Is there a simple example or documentation source anywhere?
> Thanks in advance
> Henning

I took Stefano's lib-page.xml example and used it for part of the sql taglib
demo.

So to get it to work, these are the steps that I did:

1) Edit the cocoon.properties and add the following:
    processor.xsp.library.sql.java =
resource://org/apache/cocoon/processor/xsp/library/java/sql.xsl

You will see where this goes, its down near:
# Set the libraries associated with the given namespace.
# Use the syntax:
#   processor.xsp.library.<namespace-tag>.<language> = URL to file
# where "URL to file" is usually starting with file:// if you locate
# your custom library in your file system.

2) Make sure that the <JDBC<.jar file is in the classpath, or in the
wrapper.classpath, or in my case, I've put a link to the ifxjdbc.jar
(informix) file in /usr/java1.2/jre/lib/ext directory.

3) Put the following (edit the sql:driver, etc to fit your system) in a path
that the server can reach, as well as the page-html.xsl from the samples
directory from the Cocoon distribution:

--BEGIN sql-page---
<?xml version="1.0"?>

<!-- Author: Stefano Mazzocchi "stefano@apache.org" -->
<!-- Version: $Id: lib-page.xml,v 1.5 2000/03/01 16:05:40 stefano Exp $ -->

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="page-html.xsl" type="text/xsl"?>

<xsp:page
  language="java"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:request="http://www.apache.org/1999/XSP/Request"
  xmlns:util="http://www.apache.org/1999/XSP/Util"
  xmlns:sql="http://www.apache.org/1999/SQL"
>

<page>
 <title>First XSPSQL Page</title>
 <author>
  <name>Stefano Mazzocchi</name>
  <address>stefano@apache.org</address>
 </author>

 <p>Hi, I'm your first XSP page ever.</p>

 <p>I've been requested <util:counter/> times.</p>

 <p>Let's show some useful information with expression evaluation...</p>

 <list title="Request Data">
  <element name="Request method"><request:get-method/></element>
  <element name="Request URI"><request:get-request-uri/></element>
  <element name="Request protocol"><request:get-protocol/></element>
  <element name="Servlet path"><request:get-servlet-path/></element>
  <element name="Path info"><request:get-path-info/></element>
  <element name="Path translated"><request:get-path-translated/></element>
  <element name="Query string"><request:get-query-string/></element>
  <element name="Content length"><request:get-content-length/></element>
  <element name="Content type"><request:get-content-type/></element>
  <element name="Server name"><request:get-server-name/></element>
  <element name="Server port"><request:get-server-port/></element>
  <element name="Remote user"><request:get-remote-user/></element>
  <element name="Remote address"><request:get-remote-addr/></element>
  <element name="Remote host"><request:get-remote-host/></element>
  <element name="Authorization scheme"><request:get-auth-type/></element>
 </list>

 <sql:execute-query>
   <sql:driver>com.informix.jdbc.IfxDriver</sql:driver>

<sql:dburl>jdbc:informix-sqli://vitis:1526/stores:informixserver=cbi_dbresearch</sql:dburl>

   <sql:username>???????</sql:username>
   <sql:password>???????</sql:password>
   <sql:skip-rows>0</sql:skip-rows>
   <sql:max-rows>50</sql:max-rows>
   <sql:null-indicator>y</sql:null-indicator>
   <sql:count-attribute>yes</sql:count-attribute>
   <sql:doc-element>ROWSET</sql:doc-element>
   <sql:row-element>ROW</sql:row-element>
   <sql:null-indicator>omit</sql:null-indicator>
   <sql:id-attribute>ID</sql:id-attribute>
   <sql:query>SELECT * FROM CUSTOMER;</sql:query>
 </sql:execute-query>


</page>
</xsp:page>
---END---

--
Brian Millett
Enterprise Consulting Group     "Shifts in paradigms
(314) 205-9030                     often cause nose bleeds."
bpm@ec-group.com                   Greg Glenn




Re: HowTo: SQL taglib

Posted by Donald Ball <ba...@webslingerZ.com>.
Yes, there is some documention in xdocs/sqltaglib.xml - when it's complete
it'll be up on the web site.

- donald

On Tue, 4 Apr 2000, Henning von Bargen wrote:

> I heard talking about the sql taglib, but could not find any documentation
> or example.
> Is there a simple example or documentation source anywhere?
> Thanks in advance
> Henning
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>