You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mike Engelhart <me...@earthtrip.com> on 2000/03/13 17:18:49 UTC

Re: Beginer XSP question

guiferpo@teleco.upv.es wrote:

> 
> I have the following XSP page:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?cocoon-process type="xsp"?>
> <?cocoon-process type="xslt"?>
> <?xml-stylesheet  href="frames2.xsl" type="text/xsl"?>
> 
> 
> <xsp:page language="java"
> xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> 
> <xsp:logic>
> 
> HttpSession session=request.getSession(true);
> String done=(String)session.getValue("file");
> 
> </xsp:logic>
> <session><xsp:expr>done</xsp:expr></session>
> 
> 
> </xsp:page>
> 
> 
> When i call the page i get this error.
> java.lang.Exception: XSP Java Compiler: Compilation failed for
> _frames.java
> 25: Undefined variable or class name: request
> HttpSession session=request.getSession(true);
<xsp:logic> elements that appear outside of the root XSP node (your example
doesn't have an xsp root node) are class variables outside the scope of the
request and session objects.  You need to do something like this:

<xsp:page language="java"
xmlns:xsp="http://www.apache.org/1999/XSP/Core">
       
    <document>
       <xsp:logic>
          
           HttpSession session=request.getSession(true);
           String done=(String)session.getValue("file");
             
        </xsp:logic>
        <session><xsp:expr>done</xsp:expr></session>
    </document >
  
</xsp:page>


This will work. 

Mike