cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivan" <ifon...@latinia.com>
Subject Passing parameters to an xml file to get a select from a DB
Date Fri, 02 Feb 2001 16:46:13 GMT
I'm sorry to make this question, because it could be out of topic, but i'm getting crazy ...
I was reading some info on this in http://tecfa.unige.ch/guides/xml/cocoon/mysql-xsp/ ,
but it's not exactly the same ...

My file is:

<?xml version="1.0" encoding="iso-8859-1"?>
<?cocoon-process type="xsp"?>
<?cocoon-format type="text/xml"?>
<?xml-logicsheet href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>
<xsp:page language="java" xmlns:esql="http://apache.org/cocoon/SQL/v2" xmlns:xsp="http://www.apache.org/1999/XSP/Core">
<valors>
<xsp:logic>
String country1 = request.getParameter("country1");
String country2 = request.getParameter("country2");
</xsp:logic>
<aa>
<xsp:expr>country1</xsp:expr>
</aa>
<bb>
<xsp:expr>country2</xsp:expr>
</bb>
<esql:execute-query>
<esql:driver>org.gjt.mm.mysql.Driver</esql:driver>
<esql:dburl>jdbc:mysql://localhost/fin</esql:dburl>
<esql:username/>
<esql:password/>
<esql:query>select * from countries where name&gt;='<xsp:expr>country1</xsp:expr>'
and name&lt;='<xsp:expr>country2</xsp:expr>'</esql:query>
<esql:results>
<name>
<esql:get-string column="name"/>
</name>
<siglas>
<esql:get-string column="letters"/>
</siglas>
</esql:results>
</esql:execute-query>
</valors>
</xsp:page>


passing the parameters to the file this way : countries.xml?country1=A&country2=C
(ie) to acquire the list of countries from my DB between A and B (included)

The error message goes like this:  

Error found handling the request.

java.lang.Exception: XSP Java Compiler: Compilation failed for _coutries.java
102: Undefined variable: country1 + country1         
105: Undefined variable: country2 + country2);         
2 errors

at org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJavaProcessor.java)
at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java)  
at org.apache.cocoon.Engine.handle(Engine.java) 
at org.apache.cocoon.Cocoon.service(Cocoon.java) 
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)  
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java)  
at org.apache.tomcat.core.Handler.service(Handler.java) 
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java)  
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java)  
at org.apache.tomcat.core.ContextManager.service(ContextManager.java)  
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java)
 
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java)  
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java)  
at java.lang.Thread.run(Thread.java:484)

Any idea on this?¿

TIA

Iván Fontán
Technical Department

LATINIA CORPORATION 
www.latinia.com

Spain Office
Barcelona
Trav. Gràcia, 342-344
08025 Barcelona (Spain)
Tel.: +34 934 465 026

US Offices
New York
885 3rd Avenue
Suite 2800
New York, NY 10022

Miami
1210 Brickell Avenue
Suite 430
Miami, FL 33131

Mime
View raw message