cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefano Bonnin" <s...@libero.it>
Subject xsp:expr and "method/variable scope"
Date Mon, 23 Jul 2001 14:38:45 GMT
Hi I have a problem with xsl:expr and "method scope" (I think). (I use
Tomcat 3.2.1 and Cocoon 1.8)
This is the code

<?xml version="1.0"?>
<?xml-stylesheet href="xml2html.xsl" type="text/xsl"?>
<?xml-stylesheet href="xml2wml.xsl" type="text/xsl" media="wap"?>

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

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

<xsp:structure>
 <xsp:include>smit.cde.admin.query.Query</xsp:include>
 <xsp:include>smit.cde.admin.query.QueryImpl</xsp:include>
 <xsp:include>smit.cde.admin.type.TypeCP</xsp:include>
 <xsp:include>smit.tdx.TdxObject</xsp:include>
 <xsp:include>smit.user.InfoUser</xsp:include>
</xsp:structure>
<page>

<xsp:logic>
  //Session
  HttpSession ses = request.getSession(false);
  InfoUser userInfo = (InfoUser) ses.getValue("Informations");
  String id = (String) userInfo.getUserId();
 </xsp:logic>

<!-- The following operations update the user profile -->
<esql:execute-query>

<esql:driver>sun.jdbc.odbc.JdbcOdbcDriver</esql:driver>
<esql:dburl>jdbc:odbc:Users</esql:dburl>

<esql:query>
 update users set country = '
  <xsp:expr>request.getParameter("country")</xsp:expr>' where user =
'<xsp:expr>userInfo.getUserId()</xsp:expr>' and password = 'password'
</esql:query>
</esql:execute-query>


<nextsection>
  ***New URL***
</nextsection>

</page>


when I try to compile the page I receive the following error:
java.lang.Exception: XSP Java Compiler: Compilation failed for
_compute_position.java
113: Undefined variable or class name: userInfo

      + userInfo.getUserId()

        ^

Note:
C:\foo\Tomcat\repository\_C_\_foo\_Tomcat\_webapps\_Cocoon\_samples\_Smit\_c
ompute_position.java uses or overrides a deprecated API.  Recompile with
"-deprecation" for details.

1 error, 1 warning



 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at java.lang.Exception.(Exception.java, Compiled Code)
 at
org.apache.cocoon.processor.xsp.language.java.XSPJavaProcessor.compile(XSPJa
vaProcessor.java, Compiled Code)
 at org.apache.cocoon.processor.xsp.XSPProcessor.process(XSPProcessor.java,
Compiled Code)
 at org.apache.cocoon.Engine.handle(Engine.java, Compiled Code)
 at org.apache.cocoon.Cocoon.service(Cocoon.java, Compiled Code)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java,
Compiled Code)
 at org.apache.tomcat.core.Handler.service(Handler.java, Compiled Code)
 at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java,
Compiled Code)
 at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java,
Compiled Code)
 at org.apache.tomcat.core.ContextManager.service(ContextManager.java,
Compiled Code)
 at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java, Compiled Code)
 at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
 at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
 at java.lang.Thread.run(Thread.java, Compiled Code)


why? How can I use userInfo within esql:query tag?

Thanks.




---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message