You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by sudhi <su...@planet.net> on 2000/05/23 17:01:15 UTC

Executing Prepared Statement

Hi All,
How can I execute prepared statement using SQL processor ?
Is there away to do it ? Or do I have to write my own taglib to do this
?
Thanks in advance
Sudhi

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/26/00 10:56 AM, sudhi at sudhi@planet.net wrote:

> Do you guys mind if I join the conversation with you guys :-) ?
No problem!  

Mike


Re: Some questions.

Posted by sudhi <su...@planet.net>.
Do you guys mind if I join the conversation with you guys :-) ?

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/26/00 4:08 AM, Darren Scott at dscott@bluecheese.co.uk wrote:

> sudhi wrote:
>> In this case you got to have all the content for different languages in
>> the same xml document. How do you handle different charset (encoding)?
> 
> Good point. I hadn't even considered that yet. I'm just glad I got a
> barebones solution working :)
> 
> Perhaps Mike Engelhart has some thoughts - I might venture to talk to
> him offlist if he doesn't mind an unsolicited email.

Sure send away! Because of time constraints, I had to give up on my XML
based solution to this.  As I may have mentioned I'm using Java's language
support by using ResourceBundle's which handles most of the nasties
involved.  I fully planned on using an XML/XSL solution but as of this point
it doesn't suit my needs (i.e. storing language specific context outside of
the XSL document. 
As for charsets, I believe that ResourceBundle's handle this properly as
they are java so they should be just pure Unicode.  Since i have only
attempted 5 western european languages in my testing I don't know how it
would work with say an arabic language.

> 
>> One other thing is microsoft IE5 returns
>> 
>> accept-language : en-us
>> 
>> where as Netscape
>> 
>> accept-language : en
>> 
>> Thats going to cause lot of problems ( Supporting all browsers).
> 
> Hmm, you're right. I must admit to not being up-to-date with servlet
> API, but I seem to recall >2.0 having some localization support - maybe
> it deals with that issue a bit more intelligently. I'll look into it.
The current Tomcat (3.1 Final) supports the different browsers very nicely.
I haven't run into any problems with any of the Windows, Mac or Linux
browsers that I've used as far as figuring out what language to support.


Mike 


Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
sudhi wrote:
> In this case you got to have all the content for different languages in
> the same xml document. How do you handle different charset (encoding)?

Good point. I hadn't even considered that yet. I'm just glad I got a
barebones solution working :)

Perhaps Mike Engelhart has some thoughts - I might venture to talk to
him offlist if he doesn't mind an unsolicited email.

> One other thing is microsoft IE5 returns
> 
> accept-language : en-us
> 
> where as Netscape
> 
> accept-language : en
> 
> Thats going to cause lot of problems ( Supporting all browsers).

Hmm, you're right. I must admit to not being up-to-date with servlet
API, but I seem to recall >2.0 having some localization support - maybe
it deals with that issue a bit more intelligently. I'll look into it.

> Any ways thanks for those taglibs. :-)

No probs - thanks for sharing your thoughts :)

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by sudhi <su...@planet.net>.
Thats nice,
In this case you got to have all the content for different languages in
the same xml document. How do you handle different charset (encoding)?

One other thing is microsoft IE5 returns 

accept-language : en-us

where as Netscape 

accept-language : en

Thats going to cause lot of problems ( Supporting all browsers).

Any ways thanks for those taglibs. :-)
Sudhi

Darren Scott wrote:
> 
> Darren Scott wrote:
> > > I too have built a multi-lingual site using Xalan extensions and Java's
> > > built-in ResourceBundle system
> > > What is the backend to your taglib if you don't mind me asking?  Are you
> > > using key/map in Xalan?
> >
> > A couple of people have asked me to post it - I will, but I want to work
> > on it a little more first.
> 
> Ah,
> 
> I finally got where I wanted. Still having trouble shifting to the
> document paradigm ;)
> 
> The Logicsheet now returns the language most preferred by the user, or a
> default if no preference is made or none of the users preferred
> languages are found.
> 
> Perhaps any interested parties might make some comments on the logic of
> the Logicsheet and my choice of markup (sorta looks ugly).
> 
> Does the mailing list let attachments through?
> 
> I'll put them on the web somewhere if they don't get through.
> 
> Take care, folks, I'm going home.
> 
> Darren Scott
> Production Director
> bluecheese.co.uk
> 
>   ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <xsl:stylesheet
>   version="1.0"
>   xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>   xmlns:accept-language="http://www.bluecheese.co.uk/XSP/Accept-Language"
> >
> 
> <xsl:template match="xsp:page">
>  <xsp:page>
>   <xsl:copy>
>    <xsl:apply-templates select="@*"/>
>   </xsl:copy>
>   <xsp:logic>
>     String pref_lang;
>     String accept_lang;
>     StringTokenizer st;
>     boolean done;
>   </xsp:logic>
>   <xsl:apply-templates/>
>  </xsp:page>
> </xsl:template>
> 
> <xsl:template match="accept-language:translations">
>  <xsp:logic>
>    accept_lang = request.getHeader("accept-language");
>    if (accept_lang==null) accept_lang = "";
>    accept_lang+=","+<xsl:text>"</xsl:text><xsl:value-of select="@default"/><xsl:text>"</xsl:text>;
>    st = new StringTokenizer(accept_lang,",");
>    done = false;
>    while (st.hasMoreTokens() &amp;&amp; !done) {
> 
>      pref_lang = st.nextToken().trim();
> 
>  </xsp:logic>
>  <xsl:for-each select="accept-language:translation">
>  <xsp:logic>
> 
>      if (pref_lang.equals(<xsl:text>"</xsl:text><xsl:value-of select="@language"/><xsl:text>"</xsl:text>)) {
> 
>        <xsp:content>
>         <xsl:apply-templates select="node()"/>
>        </xsp:content>
>        done = true;
>      }
> 
>   </xsp:logic>
>  </xsl:for-each>
>  <xsp:logic>
>    }
>  </xsp:logic>
> </xsl:template>
> 
> <xsl:template match="@*|node()" priority="-1">
>  <xsl:copy>
>   <xsl:apply-templates select="@*|node()"/>
>  </xsl:copy>
> </xsl:template>
> 
> </xsl:stylesheet>
> 
>   ------------------------------------------------------------------------
> <?xml version="1.0"?>
> <?xml-stylesheet href="debug.xsl" type="text/xsl?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <xsp:page
>  language="java"
>  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>  xmlns:accept-language="http://www.bluecheese.co.uk/XSP/Accept-Language"
> >
> 
>  <mypage>
> 
>   I think you should see the page:-
> 
>   <accept-language:translations default="fr">
>    <accept-language:translation language="en">
>      In English
>    </accept-language:translation>
>    <accept-language:translation language="fr">
>      En Francais
>    </accept-language:translation>
>   </accept-language:translations>
> 
>  </mypage>
> 
> </xsp:page>
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
Darren Scott wrote:
> > I too have built a multi-lingual site using Xalan extensions and Java's
> > built-in ResourceBundle system
> > What is the backend to your taglib if you don't mind me asking?  Are you
> > using key/map in Xalan?
> 
> A couple of people have asked me to post it - I will, but I want to work
> on it a little more first.

Ah,

I finally got where I wanted. Still having trouble shifting to the
document paradigm ;)

The Logicsheet now returns the language most preferred by the user, or a
default if no preference is made or none of the users preferred
languages are found.

Perhaps any interested parties might make some comments on the logic of
the Logicsheet and my choice of markup (sorta looks ugly).

Does the mailing list let attachments through?

I'll put them on the web somewhere if they don't get through.

Take care, folks, I'm going home.

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
Mike Engelhart wrote:
> Hey Darren,
> I too have built a multi-lingual site using Xalan extensions and Java's
> built-in ResourceBundle system
> What is the backend to your taglib if you don't mind me asking?  Are you
> using key/map in Xalan?

Mike,

It doesn't use a backend - it is a taglib which selects the most
appropriate source tree fragments based on the user-agent's language
header.

I am working on the assumption that translations are kept in the same
document, but I guess it could be used to include different external
files - I haven't experimented properly yet.

A couple of people have asked me to post it - I will, but I want to work
on it a little more first. 

Regards

Darren Scott
Production Director
bluecheese.co.uk

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/25/00 9:15 AM, sudhi at sudhi@planet.net wrote:

> Hey guys,
> I would really appreciate, if you guys could tell me how to go about it.
> Since I am very new to Cocoon and even xml. Any help would be really
> appreciated.
> Thanks in advance
> Sudhi
There are a bunch of my rambling postings in the archives about using
ResourceBundle's and Xalan extensions.  I don't have time right now to
rewrite them but they are in there.  Just search for my name.

mike


Re: Some questions.

Posted by sudhi <su...@planet.net>.
Hey guys,
I would really appreciate, if you guys could tell me how to go about it.
Since I am very new to Cocoon and even xml. Any help would be really
appreciated.
Thanks in advance
Sudhi

Mike Engelhart wrote:
> 
> on 5/25/00 3:51 AM, Darren Scott at dscott@bluecheese.co.uk wrote:
> 
> > I am working on a multilingual taglib at the moment. So far, it will
> > display the site in the users preferred language according to the
> > 'accept-language' header, but it doesn't display the users next choice
> > if that language isn't available and so on - which is the part I am
> > working on now.
> >
> > It should not be very long before I'm done, and it will make maintaining
> > multilingual sites a pop.
> Hey Darren,
> I too have built a multi-lingual site using Xalan extensions and Java's
> built-in ResourceBundle system
> What is the backend to your taglib if you don't mind me asking?  Are you
> using key/map in Xalan?
> 
> thanks
> 
> Mike
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Re: Some questions.

Posted by Mike Engelhart <me...@earthtrip.com>.
on 5/25/00 3:51 AM, Darren Scott at dscott@bluecheese.co.uk wrote:

> I am working on a multilingual taglib at the moment. So far, it will
> display the site in the users preferred language according to the
> 'accept-language' header, but it doesn't display the users next choice
> if that language isn't available and so on - which is the part I am
> working on now.
> 
> It should not be very long before I'm done, and it will make maintaining
> multilingual sites a pop.
Hey Darren,
I too have built a multi-lingual site using Xalan extensions and Java's
built-in ResourceBundle system
What is the backend to your taglib if you don't mind me asking?  Are you
using key/map in Xalan?

thanks

Mike


Re: Some questions.

Posted by Darren Scott <ds...@bluecheese.co.uk>.
sudhi wrote:
> 1. For example, if I build a multi lingual web site, which displays the
> contents in different languages, How does Cocoon fit in ? What do I have
> to do to serve multi lingual pages.

I am working on a multilingual taglib at the moment. So far, it will
display the site in the users preferred language according to the
'accept-language' header, but it doesn't display the users next choice
if that language isn't available and so on - which is the part I am
working on now.

It should not be very long before I'm done, and it will make maintaining
multilingual sites a pop.

Darren Scott
Production Director
bluecheese.co.uk

Some questions.

Posted by sudhi <su...@planet.net>.
Hi All,
I am very new to cocoon. I did play around with it a little. And I
really like it a lot. Thanks to all the people who created it :-).
How ever I have two questions regarding Cocoon.

1. For example, if I build a multi lingual web site, which displays the
contents in different languages, How does Cocoon fit in ? What do I have
to do to serve multi lingual pages. 

2. I have a bunch of xml files. And I want search those xml files for
some content. Whats the best way to do it ? Does Cocoon has anything for
it ?
Or do I have to write my own search engine kind of code ?

Thanks in advance
Sudhi

Re: Executing Prepared Statement

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 24 May 2000, sudhi wrote:

> > 
> > try running it as you would from the sql command line - generally
> > something like this:
> > 
> > call next-article()
> > 
> > if you can suggest an appropriate syntax, i'll be happy to add specific
> > support for prepared statements in the sql taglib.
> > 
> Is it possible to implement it it in the same as java and JDBC ?
> Like create a statement, and set the fields one by one.
> (some thing like this)
>         String sqlstmt = "insert into files (filename,title)
> values(?,?)"
>         PreparedStatement stmt = conn.prepareStatement(sqlstmt);
>         stmt.setString(1,filename);
>         stmt.setString(2,title);

what does that get you that generating the query in the XSP page does not?

- donald


Re: Executing Prepared Statement

Posted by sudhi <su...@planet.net>.
> 
> try running it as you would from the sql command line - generally
> something like this:
> 
> call next-article()
> 
> if you can suggest an appropriate syntax, i'll be happy to add specific
> support for prepared statements in the sql taglib.
> 
Is it possible to implement it it in the same as java and JDBC ?
Like create a statement, and set the fields one by one.
(some thing like this)
        String sqlstmt = "insert into files (filename,title)
values(?,?)"
        PreparedStatement stmt = conn.prepareStatement(sqlstmt);
        stmt.setString(1,filename);
        stmt.setString(2,title);
........



~Sudhi

Re: Executing Prepared Statement

Posted by Donald Ball <ba...@webslingerZ.com>.
On Tue, 23 May 2000, sudhi wrote:

> Hi All,
> How can I execute prepared statement using SQL processor ?
> Is there away to do it ? Or do I have to write my own taglib to do this
> ?

try running it as you would from the sql command line - generally
something like this:

call next-article()

if you can suggest an appropriate syntax, i'll be happy to add specific
support for prepared statements in the sql taglib.

- donald


Re: Producers (again?)

Posted by Jonathan Stimmel <jo...@stimmel.net>.
> Matthew Langham wrote:
> > Well after several weeks of playing and demo-ing Cocoon - it really rocks!
> > However (:-)) there is one small thing I still cant really come to like: The
> > way Producers are invoked (via the xxx.xml?Producer=MyProducer method. This
> > seems (to me) to be really kludgy. Surely there is a better way of doing
> > this?

Cocoon2 will address this problem by allowing you to specify a processing
path based on the URL. Until then, you'll probably get the most flexibility
by using XSP ;)

RE: Producers (again?)

Posted by Alistair Hopkins <al...@berthengron.co.uk>.
I'm using producers

I am writing an app which needs full session management & authentication
(and a load of other stuff...).

I can do that easily using producers by writing an abstract producer to
manage all the generic stuff (sessions checking, DoS prevention, database
connection pooling, error handling), then extending it for each chunk of
functionality I wish to add to the app.  I don't believe that xsp supports
inheritance, so I've not seriously considered it.  What I've got with
producers is a situatiuon where for each bit of functionality, I only write
the logic and forget the housekeeping.

Am I barking up the wrong tree?

I know this isn't publishing, but as cocoon does the transform so nicely,
and gives me all that caching and control, I just don't see the point in
using Xalan directly myself!  I also save a pile of coding by using the same
XML generation code with different stylesheets (selected dynamically by user
type) to produce read only and editable versions of the same data.

Also, the ugly url doesn't bother me, I must admit.

-----Original Message-----
From: Perry Hoekstra [mailto:dutchman@uswest.net]
Sent: Tuesday, May 23, 2000 9:01 PM
To: cocoon-users@xml.apache.org
Subject: Re: Producers (again?)


Matthew Langham wrote:
>
> Well after several weeks of playing and demo-ing Cocoon - it really rocks!
> However (:-)) there is one small thing I still cant really come to like:
The
> way Producers are invoked (via the xxx.xml?Producer=MyProducer method.
This
> seems (to me) to be really kludgy. Surely there is a better way of doing
> this?
>
> Say I have written an RMI-Producer which connects up to some
RMI-Application
> and retrieves XML. I really want to be able to call the producer directly
> and pass in some request parameters. Can I do this with a producer without
> specifying an XML-file? It would be so much easier to migrate exisiting
> servlets over to producers if this was possible (or am I missing
> something?).
>
> Ok ok - if enough of you say "Use XSP to do that" then I suppose I will
have
> to learn it :-)
>
> Matthew

I would also love to have that ability.  Right now, I cannot migrate my
presentation over XSP but I do have the ability to migrate some of
backend stuff over to Producers.

--
Perry Hoekstra
Consultant
Talent Software Services
dutchman@mn.uswest.net

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org



Re: Producers (again?)

Posted by Perry Hoekstra <du...@uswest.net>.
Matthew Langham wrote:
> 
> Well after several weeks of playing and demo-ing Cocoon - it really rocks!
> However (:-)) there is one small thing I still cant really come to like: The
> way Producers are invoked (via the xxx.xml?Producer=MyProducer method. This
> seems (to me) to be really kludgy. Surely there is a better way of doing
> this?
> 
> Say I have written an RMI-Producer which connects up to some RMI-Application
> and retrieves XML. I really want to be able to call the producer directly
> and pass in some request parameters. Can I do this with a producer without
> specifying an XML-file? It would be so much easier to migrate exisiting
> servlets over to producers if this was possible (or am I missing
> something?).
> 
> Ok ok - if enough of you say "Use XSP to do that" then I suppose I will have
> to learn it :-)
> 
> Matthew
 
I would also love to have that ability.  Right now, I cannot migrate my
presentation over XSP but I do have the ability to migrate some of
backend stuff over to Producers.

-- 
Perry Hoekstra
Consultant
Talent Software Services
dutchman@mn.uswest.net

Re: Producers (again?)

Posted by Ulrich Mayring <ul...@denic.de>.
Matthew Langham wrote:
> 
> Ok ok - if enough of you say "Use XSP to do that" then I suppose I will
> have
> to learn it :-)

Use XSP to do that :-)

Seriously, when I started out with cocoon I looked at the DCP processor
(deprecated now), XSP and producers. From all those I found XSP to be
the easiest thing to learn, so I went that way. It's not hard at all,
just look at the samples.

Ulrich

-- 
Ulrich Mayring
DENIC eG, Systementwicklung

Producers (again?)

Posted by Matthew Langham <ml...@sundn.de>.
Well after several weeks of playing and demo-ing Cocoon - it really rocks!
However (:-)) there is one small thing I still cant really come to like: The
way Producers are invoked (via the xxx.xml?Producer=MyProducer method. This
seems (to me) to be really kludgy. Surely there is a better way of doing
this?

Say I have written an RMI-Producer which connects up to some RMI-Application
and retrieves XML. I really want to be able to call the producer directly
and pass in some request parameters. Can I do this with a producer without
specifying an XML-file? It would be so much easier to migrate exisiting
servlets over to producers if this was possible (or am I missing
something?).

Ok ok - if enough of you say "Use XSP to do that" then I suppose I will have
to learn it :-)

Matthew

--
Build revolutionary products - and they will come (Guy Kawasaki)
=================================================================
Matthew Langham, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
Tel: +49-5251-1581-30   [mlangham@sundn.de - http://www.sundn.de]
=================================================================


------------------------------------------------------------------------------------------
...this mail was scanned for viruses by mailserver...