cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Naquin, Beth" <Beth.Naq...@morpho.com>
Subject RE: XSP help
Date Wed, 19 Jun 2002 22:34:53 GMT
The file I was talking about was /docs/samples/xsp/logicsheet.xsp in the
cocoon examples.

Basically, it does one thing (ie show a form with input text box) if the
'name' parameter is null.  It does something else (ie print the name that
was entered) if the name parameter is not null.

In the form validation examples, there's a bit of code that will allow you
to know if the user has had a chance to fill in any data yet, or if it's the
first time the use is looking at the page.

It goes something like this ...
----------------------------------------------------------------------------
-----------------
<form ...>

<!-- 
 use this to get a clue if the user had a chance to fill in
            any data already 

  --> 
  <input type="hidden" name="visited" value="true" /> 


</form>

 <xsp:logic>
  boolean userHasSeenForm = ( 
  <xsp-request:get-parameter name="visited" /> 
  !=null); 

  if(userHasSeenForm){
	user has already entered data and pressed submit, so do something
different
	} 
  </xsp:logic>


----------------------------------------------------------------------------
--------------------------------

You can gather the input from the textbox using <xsp-request> (check out
docs on the request logicsheet)

ex: String x = <xsp-request:get-parameter
name="name_of_your_textarea_field_in_the_form"/>;

Maybe you could do something like this: if(userHasSeenForm){do your query
stuff & print results}

I am new to cocoon myself, so I'm not sure this is the best way to do things
(embedding all your logic right into the xsp page), but seems like it should
work.

-----Original Message-----
From: Gerardo_Flores@mckinsey.com [mailto:Gerardo_Flores@mckinsey.com]
Sent: Wednesday, June 19, 2002 2:27 PM
To: cocoon-users@xml.apache.org
Subject: RE: XSP help



Thanks for the info.  Both you and Vadim were very helpful....I have
definately read much more about XSP and recognize the mistake in my last
approach.  I was, however, unable to find the the example that you state
that is a form with a text input and a submit button.  That's exactly what
I was looking for!  So far, this is what I have:
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
                 xmlns:xsp-request="http://apache.org/xsp/request/2.0"
                 xmlns:sql="http://apache.org/cocoon/SQL/v2">

   <xsp:structure>
      <xsp:include>java.text.*</xsp:include>
   </xsp:structure>
   <document>
   <title>Generation of Metadata.xml</title>
   <form action="" method="POST" name="Metadata">
   <!--
     <h1>Enter input</h1>
     <textarea name="KO" rows=6 cols=80></textarea>
     <input type=submit value="Generate Metadata">
     <input type=reset value="Reset Form">
   -->
   </form>
   <metadata>
............
    <authors>
     <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
      <query>
     select * from H2KOBJ.MCK_MDR_PPTY_PD_RLSHP_V  where KO_ID = 400400 and
PPTY_KO_RLSHP_TYPE_ID IN (1,7)
      </query>
     </execute-query>
    </authors>

    <contacts>
     <execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
      <query>
     select * from H2KOBJ.MCK_MDR_PPTY_PD_RLSHP_V where KO_ID = 400400 and
PPTY_KO_RLSHP_TYPE_ID IN (5,13)
      </query>
     </execute-query>
    </contacts>
.............
   </metadata>
   </document>
</xsp:page>

Ideally, I would like to do what the sample that you stated does and show
the results of the queries on the same page.  The input from the textarea
will be parsed and I would like to substitute each token into the KO_ID
field in each query...something like <xsp:expr>queryresult</xsp:expr> for
each token.  Could anyone guide me a little further.  I still can't take
that step and figure out how to gather the input from the textbox, only
perform the queries after having done so, and also how to display the
results on the same page.  The last part really isn't that critical as I
could just put it in another file.

Any help would be greatly appreciated.

-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:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

Mime
View raw message