You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Ge...@mckinsey.com on 2002/06/19 19:26:46 UTC

XSP help

Hello all, first post to this listserv :)  I'm having a little trouble
learning how to write XSPs.  I want to perform a very simple task, yet
really can't find many examples of XSPs anywhere on the web that will help
me accomplish my task.  What I would like to do is write an XSP that will
display a text area and a submit button and will then perform a database
query with the contents of the string retrieved from the text area.  I
really have no real idea of how to start.  I was basing myself on the file
upload example in Cocoon but getting nowhere.  I'm using Tomcat 3.2 and
Cocoon 2.0.  So far what I have is something like this that I hope makes
some sense:

<?xml version="1.0"?>
<?cocoon-process type="xsp"?>
<xsp:page
  language="java"
  xmlns:xsp="http://www.apache.org/1999/XSP/Core"
  xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  xmlns:xsp-response="http://apache.org/xsp/response/2.0"
  xmlns:log="http://apache.org/xsp/log/2.0">

 <page>
    <title>Search for a Knowledge Object</title>
    <content>
      <para>
        <form method="post" enctype="multipart/form-data" action="upload">
         <textarea name="KONames" rows=6 cols=80></textarea>
      <p><input type="submit" value="Generate Metadata" /></p>
        </form>
      </para>
      <para>
      <ul>
        <xsp:logic>


        </xsp:logic>
      </ul>
      </para>

    </content>
  </page>

</xsp:page>

Then in the XSP:logic tags, I would perform the necessary queries.  Don't
know if this is the way to go about it.  Also, I know that I must change
the action attribute in <form> to something else, but what?  What I don't
understand is how to make my code run after the submit button has been
pressed.  I am assuming that this XSP page will generate xml and then I can
apply a stylesheet to format the data as I see fit.  Am I totally going
about this the wrong way?  Could anyone suggest a better approach.  It
seems as though XSP resources on the web are limited, could someone also
point me to some good XSP sites?

Thanks in advance,

-gerardo

+---------------------------------------------------------+
This message may contain confidential and/or privileged
information.  If you are not the addressee or authorized to
receive this for the addressee, you must not use, copy,
disclose or take any action based on this message or any
information herein.  If you have received this message in
error, please advise the sender immediately by reply e-mail
and delete this message.  Thank you for your cooperation.
+---------------------------------------------------------+


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: XSP help

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: Gerardo_Flores@mckinsey.com [mailto:Gerardo_Flores@mckinsey.com]
> 
> Hello all, first post to this listserv :)  I'm having a little trouble
> learning how to write XSPs. 

Please start learning XSP writing with reading samples which are
provided with the Cocoon. 

There are several things which you got wrong in your XSP. Once you
compare your XSP with the samples, it will be obvious to you what is
wrong.

For database queries, take a look at ESQL logicsheet XSP sample and
SQLTransformer sample.

Vadim


> I want to perform a very simple task, yet
> really can't find many examples of XSPs anywhere on the web that will
help
> me accomplish my task.  What I would like to do is write an XSP that
will
> display a text area and a submit button and will then perform a
database
> query with the contents of the string retrieved from the text area.  I
> really have no real idea of how to start.  I was basing myself on the
file
> upload example in Cocoon but getting nowhere.  I'm using Tomcat 3.2
and
> Cocoon 2.0.  So far what I have is something like this that I hope
makes
> some sense:
> 
> <?xml version="1.0"?>
> <?cocoon-process type="xsp"?>
> <xsp:page
>   language="java"
>   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>   xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>   xmlns:xsp-response="http://apache.org/xsp/response/2.0"
>   xmlns:log="http://apache.org/xsp/log/2.0">
> 
>  <page>
>     <title>Search for a Knowledge Object</title>
>     <content>
>       <para>
>         <form method="post" enctype="multipart/form-data"
action="upload">
>          <textarea name="KONames" rows=6 cols=80></textarea>
>       <p><input type="submit" value="Generate Metadata" /></p>
>         </form>
>       </para>
>       <para>
>       <ul>
>         <xsp:logic>
> 
> 
>         </xsp:logic>
>       </ul>
>       </para>
> 
>     </content>
>   </page>
> 
> </xsp:page>
> 
> Then in the XSP:logic tags, I would perform the necessary queries.
Don't
> know if this is the way to go about it.  Also, I know that I must
change
> the action attribute in <form> to something else, but what?  What I
don't
> understand is how to make my code run after the submit button has been
> pressed.  I am assuming that this XSP page will generate xml and then
I can
> apply a stylesheet to format the data as I see fit.  Am I totally
going
> about this the wrong way?  Could anyone suggest a better approach.  It
> seems as though XSP resources on the web are limited, could someone
also
> point me to some good XSP sites?
> 
> Thanks in advance,
> 
> -gerardo


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>