I will prepare a new patch for this. I am currently using it with the lastest CVS version of 2.1.
I also made some enhancement. It now returns as="string". Antonio Gallardo El Viernes, 25 de Octubre de 2002 05:14, Bert Van Kets escribió: > I tried this already. This does not work! > Here's my page: > > <?xml version="1.0" encoding="UTF-8"?> > <xsp:page language="java" xmlns:xsp="http://apache.org/xsp" > xmlns:esql="http://apache.org/cocoon/SQL/v2" > xmlns:xsp-session="http://apache.org/xsp/session/2.0"> > <users> > <esql:connection> > <esql:pool>bvar</esql:pool> > <esql:execute-query> > <esql:query>SELECT * FROM members WHERE > ID=<esql:parameter><xsp-session:getxml context="authentication" > path="/authentication/ID" as="string"/></esql:parameter></esql:query> > <esql:results> > <esql:row-results> > <user> > <esql:get-columns/> > </user> > </esql:row-results> > </esql:results> > </esql:execute-query> > </esql:connection> > </users> > </xsp:page> > > And here's the error : > org.apache.cocoon.ProcessingException: Language Exception: > org.apache.cocoon.components.language.LanguageException: Error compiling > test_xsp: > Line 371, column 18: illegal start of expression > Line 0, column 0: > 1 error > > Here's a snip of the content. Line 371 is teh line starting with the + > sign: > > try { > > _esql_query.getPreparedStatement().setString(1,String.valueOf( "" > > > + )); > > } catch (SQLException _esql_exception_N1001C) { > throw new RuntimeException("Error setting parameter on > statement: " + _esql_query.getQueryString() + ": "+_esql_exception_N1001C); > } > > > What else can I try? > > Bert > > At 13:38 25/10/2002 +0300, you wrote: > >Hi Bert, > > > >Try to put <esql:parameter> around <xsp-sessio:getxml> in your query. > > > >-Tuomo > > > >On Fri, 25 Oct 2002, Bert Van Kets wrote: > > > Hi Antonio, > > > I've been trying hard to get this esql sample to work. > > > The tag works perfectly. > > > <user><xsp-session:getxml context="authentication" > > > path="/authentication/ID"/></user> > > > returns the userID in my xsp page. So there is nothing wrong with the > > > class or the session.xsl file. > > > > > > However, I need to create a query containing the userID. I think I > > > went through the whole book of exceptions in Cocoon. :-( > > > When I try it the way you describe below, I get an error saying "method > > > parseInt() not found in class java.lang.Integer". I guess this means > > > nothing is returned and the parseInt can't convert. > > > I've tried all kind of combinations and always get an error. > > > Here's what I've got now (doesn't work of course): > > > > > > <esql:execute-query> > > > <esql:query>SELECT * FROM members WHERE ID=<xsp-session:getxml > > > context="authentication" path="/authentication/ID" > > > > as="string"/></esql:query> > > > > > <esql:results> > > > <esql:row-results> > > > <esql:get-columns/> > > > </esql:row-results> > > > </esql:results> > > > </esql:execute-query> > > > > > > What am I missing here???? > > > > > > > > > Bert > > > > > > P.S. Using Cocoon 2.1 build of 14 May 2002, Tomcat 4.0.1, JDK 1.3.1_2 > > > > > > At 05:54 8/10/2002 -0600, you wrote: > > > >Another usage of this tag is to set the parameters of a query based on > > > > the is > > > > > >in <esql:query> see the example: > > > > > > > ><esql:query> > > > > SELECT usr_name, usr_full_name, usr_password FROM users > > > > WHERE usr_id = > > > > <esql:parameter type="int"> > > > > <xsp:expr> > > > > Integer.parseInt( > > > > <xsp-session:getxml context="authentication" > > > > path="/authentication/ID" > > > >as="string"/>) > > > > </xsp:expr> > > > > </esql:parameter> > > > ></esql:query> > > > > > > > >Antonio Gallardo > > > > > > > >El Martes, 08 de Octubre de 2002 05:43, Antonio Gallardo Rivera escribió: > > > > > Hi, I recently needed to write some app logi usin <xsp:logic> tags. > > > > Into > > > > > > > tags we need to write some code like: > > > > > > > > > > String myUserID = <xsp-session:getxml context="authentication" > > > > > path="/authentication/ID" as="string"/>; > > > > > > > > > > Then, I updated <xsp-session:getxml> to serve strings. > > > > > > > > > > Currently the attribute "as" of the element can have 3 values: > > > > > > > > > > 1-as="object" (default) returns a org.w3c.dom.DocumentFragment > > > > object. More > > > > > > > info at > > > > http://xml.apache.org/xerces2-j/javadocs/api/org/w3c/dom/DocumentFragment > >.h > > > > > > >tml > > > > > > > > > > 2-as="xml" return the DocumentFragment into <xsp-session:xml> tags. > > > > > > > > > > 3- return the value of the firstchild of the requested node. > > > > Example: If we > > > > > > > have: > > > > > > > > > > <ID>MyID</ID> > > > > > <role>MyRole</role> > > > > > <data> > > > > > <fullname>TheFullName</fullname> > > > > > > > > > > A) Then if we write: > > > > > <xsp-session:getxml context="authentication" > > > > > path="/authentication/ID" as="string"/> > > > > > > > > > > will return "MyID" > > > > > > > > > > B) <xsp-session:getxml context="authentication" > > > > > path="/authentication/data/fullname" as="string"/> > > > > > > > > > > will return: "TheFullName" > > > > > > > > > > Attached is the new session.xsl the place of this file is: > > > > xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/jav > >a > > > > > > > Antonio Gallardo > > > > > > > >--------------------------------------------------------------------- > > > >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: <[EMAIL PROTECTED]> > > > >For additional commands, e-mail: <[EMAIL PROTECTED]> > > > > > > --------------------------------------------------------------------- > > > 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: <[EMAIL PROTECTED]> > > > For additional commands, e-mail: <[EMAIL PROTECTED]> > > > >--------------------------------------------------------------------- > >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: <[EMAIL PROTECTED]> > >For additional commands, e-mail: <[EMAIL PROTECTED]> > > --------------------------------------------------------------------- > 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: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- 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: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>