cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher Painter-Wakefield" <paint...@mc.duke.edu>
Subject Re: request taglib + query
Date Tue, 14 Aug 2001 15:33:16 GMT

Anne Marie,

this may sound completely stupid, but remove the semicolon at the end of
your query.  I copied your XML into a new file in my project and edited it
to make the query match tables in my database and changed the pool to one
of my own pools.  I also removed your stylesheets and used a simple source
formatter stylesheet.  I made no other changes.  When I ran the query with
an appropriate parameter, I got no results.  When I edited the file to
remove the semicolon, I got results.  Just to make sure, I added the
semicolon back in, and sure enough, I got no results again.  Perhaps this
is some JDBC thing.  I do know that all of the working examples I have
seen, and all of the queries in my own code, are not terminated in any way.

-Christopher




Please respond to cocoon-users@xml.apache.org

To:   cocoon-users@xml.apache.org
cc:

Subject:  request taglib + query


Hi all,

and thanks for helping me so much!

Unfortunately, I still cannot get my page to do what I want:

*I am able to pick up the http request parameter from the URL and display
it
*I am able to run the query if I hardcode the value
*But I am not able to run the query with the value that I pick up from the
URL!

I have also included the xml file and the generated java code. It looks
fine
to me. You can see that I have put a request in the xml document just to
display, and this displays OK on the screen. But for some reason it won't
work in the query... The java code generated in each case is the same,
isn't
it?

*I have tried with ?userID=55512345
                   ?userID='55512345'
                   ?userID="55512345"
*I have tried to have the database field as a string and as an integer
*Using xsp-request instead of request doesn't work (I think maybe that's
for
C2?)
*I have tried EVERY other suggestion that I have received, but with no luck

I guess the reason must be that the query is attempted run BEFORE the
parameter is found. Does anybody have any idea how I can work around this
to
use the parameter in the query?

I would also like to try to store the parameter in a variable, and then try
and use the variable in the query to see if that works. Does anybody now
how
I can do that? Christopher and Max, you both had an idea of building the
query as a string with xsp:logic, but I am not able to do it right! If I
try
to use request.GetParameter I get error messages...

Thanks again!

Regards
Anne Marie

Welcome.xml:

<?xml version="1.0" standalone="no"?>
<?xml-stylesheet href="welcome-html.xsl" type="text/xsl"?>
<?xml-stylesheet href="welcome-wml.xsl" type="text/xsl" media="wap"?>

<?cocoon-process type="xsp"?>
<?cocoon-process type="xslt"?>

<!-- Welcome.xml -->
<!-- Written by Anne Marie Hartvigsen -->

<!DOCTYPE document [
  <!ENTITY email "amhartvi@stud.hia.no">
]>

<xsp:page language="java"
          xmlns:xsp="http://www.apache.org/1999/XSP/Core"
          xmlns:esql="http://apache.org/cocoon/SQL/v2"
          xmlns:request="http://www.apache.org/1999/XSP/Request"
>

<document>
  <head>
    <pagetitle title="Titleinfo"/>
  </head>

  <body>
    <h1>
      Welcome,
      <request:get-parameter name="userID"/>
    </h1>

    <p>
      Below the query results should be displayed.
    </p>
    <p/>

    <br></br>

    <reg_data>
<esql:connection>

  <esql:pool>
    annemarie
  </esql:pool>

  <esql:execute-query>
    <esql:query>
      select name as reg_name,
             deviceID as reg_deviceID,
             description as reg_description,
             startTime as reg_startTime,
             endTime as reg_endTime
      from user, terminal, deviceType, registration
      where terminal.userID = <request:get-parameter name="userID"/>
            and user.userID = terminal.userID
            and deviceType.deviceType = terminal.deviceType
            and registration.terminalID = terminal.terminalID;
    </esql:query>
    <esql:results>
      <header>
        These are your registrations,
      </header>
      <esql:row-results>
        <username>
          <esql:get-string column="reg_name"/>
        </username>
        <registration>
          <deviceID>
            <esql:get-string column="reg_deviceID"/>
          </deviceID>
          <description>
            <esql:get-string column="reg_description"/>
          </description>
          <startTime>
            <esql:get-string column="reg_startTime"/>
          </startTime>
          <endTime>
            <esql:get-string column="reg_endTime"/>
          </endTime>
        </registration>
      </esql:row-results>
    </esql:results>
  </esql:execute-query>
</esql:connection>

    </reg_data>



     <br></br>

    <signature>
      Made by: &email;
    </signature>
  </body>
</document>
</xsp:page>






---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.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