cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <ba...@webslingerZ.com>
Subject Re: XSL/XSP
Date Wed, 02 Aug 2000 07:10:04 GMT
On Tue, 1 Aug 2000, Rogerio Lacerda wrote:

> I'm trying to get session parameter, but this error raise:
> 
> 25: Undefined variable or class name: request
>       String id = request.getParameter("id");
> 
> Whats the matter ??? The dynamic XSL cant get sessions parameters ???
> 
> The XML document is static, defined for other application...
> 
> Regards,
> 
> Roger
> 
> PS:The source:
> 
>     <xsp:logic>
>       static private int counter = 0;
>       String id = request.getParameter("id");
>     </xsp:logic>

the statement needs to appear underneath your root element:

<xsp:page>
 <xsp:logic>
  static private int counter = 0;
 </xsp:logic>
 <page>
  <xsp:logic>
   String id = request.getParameter("id");
  </xsp:logic>
 </page>
</xsp:page>

xsp:logic elements outside of your root element are treated as class
variables - they don't appear in a method. it's like writing:

public class test {

  static private int counter = 0;
  String id = request.getParameter("id");

}

even if request was in scope at the time, it's forbidden for statements to
appear outside of a method or static initializer block.

- donald


Mime
View raw message