You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Rogerio Lacerda <ro...@newmail.net> on 2000/08/01 21:41:02 UTC
XSL/XSP
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>
Re: [Cocoon Devel]XSL/XSP
Posted by Donald Ball <ba...@webslingerZ.com>.
On 3 Aug 2000, Brian May wrote:
> >>>>> "Donald" == Donald Ball <ba...@webslingerZ.com> writes:
>
> Donald> are you using cocoon2? if not, your namespace declarations
> Donald> are wrong. if so, i'm afraid i will have to defer to
> Donald> ricardo or another cocoon2 expert - i've had sadly little
> Donald> time to play with cocoon2 since pier's initial
> Donald> implementation many months ago.
>
> Yes. I am using cocoon2. I thought this thread was cocoon2, on double
> checking, I see I was probably mistaken. Oops. Sorry for any
> confusion.
well, as far as i can tell, your page should still work fine. you might
examine the generated java page to see where it looks malformed and use
that as a starting point.
- donald
Re: [Cocoon Devel]XSL/XSP
Posted by Brian May <ba...@snoopy.apana.org.au>.
>>>>> "Donald" == Donald Ball <ba...@webslingerZ.com> writes:
Donald> are you using cocoon2? if not, your namespace declarations
Donald> are wrong. if so, i'm afraid i will have to defer to
Donald> ricardo or another cocoon2 expert - i've had sadly little
Donald> time to play with cocoon2 since pier's initial
Donald> implementation many months ago.
Yes. I am using cocoon2. I thought this thread was cocoon2, on double
checking, I see I was probably mistaken. Oops. Sorry for any
confusion.
--
Brian May <ba...@snoopy.apana.org.au>
Re: XSL/XSP
Posted by Donald Ball <ba...@webslingerZ.com>.
On 3 Aug 2000, Brian May wrote:
> >>>>> "Donald" == Donald Ball <ba...@webslingerZ.com> writes:
>
> Donald> post the whole page - i reckon the problem is in one of
> Donald> the [...] areas.
>
> Ok, you asked for it ;-)
>
> Seriously: normally my code looks better then this, however, this is
> the best I could do with my current knowledge of XSP. Any hints on how
> to improve it would be appreciated... I can't help but think that this
> code is *much* more complicated then it needs to be. If you need
> help trying to work out how it is meant to work, just ask.
>
> This use to work (believe it or not) 1st-July.
are you using cocoon2? if not, your namespace declarations are wrong. if
so, i'm afraid i will have to defer to ricardo or another cocoon2 expert -
i've had sadly little time to play with cocoon2 since pier's initial
implementation many months ago.
- donald
Re: XSL/XSP
Posted by Brian May <ba...@snoopy.apana.org.au>.
>>>>> "Donald" == Donald Ball <ba...@webslingerZ.com> writes:
Donald> post the whole page - i reckon the problem is in one of
Donald> the [...] areas.
Ok, you asked for it ;-)
Seriously: normally my code looks better then this, however, this is
the best I could do with my current knowledge of XSP. Any hints on how
to improve it would be appreciated... I can't help but think that this
code is *much* more complicated then it needs to be. If you need
help trying to work out how it is meant to work, just ask.
This use to work (believe it or not) 1st-July.
Re: [Cocoon Devel]XSL/XSP
Posted by Donald Ball <ba...@webslingerZ.com>.
On 3 Aug 2000, Brian May wrote:
> Hello All,
>
> I have a similar problem with the following XSP code:
>
> [...]
> <result id="gb-addentry">
>
> <xsp:logic>
> String name=request.getParameter("name");
> [...]
> </xsp:logic>
>
> </result>
> [...]
post the whole page - i reckon the problem is in one of the [...] areas.
- donald
Re: [Cocoon Devel]XSL/XSP
Posted by Brian May <ba...@snoopy.apana.org.au>.
Hello All,
I have a similar problem with the following XSP code:
[...]
<result id="gb-addentry">
<xsp:logic>
String name=request.getParameter("name");
[...]
</xsp:logic>
</result>
[...]
>>>>> "Ricardo" == Ricardo Rocha <ri...@apache.org> writes:
Ricardo> The "request" object is accessible _only_ inside the
Ricardo> "populateDocument" method (i.e. inside the user root
Ricardo> element). It's _not_ accessible inside the class-level
Ricardo> section (i.e., <xsp:logic> right beneath the root
Ricardo> <xsp:element>).
How do you get stuff into the populateDocument method? I can't see
that method in the output Java code. Instead, everything is in the
"generate" method. The variable "request" is not defined anywhere.
>>>>> "Donald" == Donald Ball <ba...@webslingerZ.com> writes:
Donald> the statement needs to appear underneath your root
Donald> element:
Donald> <xsp:page> <xsp:logic> static private int counter = 0;
Donald> </xsp:logic> <page> <xsp:logic> String id =
Donald> request.getParameter("id"); </xsp:logic> </page>
Donald> </xsp:page>
Its my impression I do this correctly. ie <result ...> is my root
element.
--
Brian May <ba...@snoopy.apana.org.au>
Re: XSL/XSP
Posted by Ricardo Rocha <ri...@apache.org>.
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...
> PS:The source:
>
> <xsp:logic>
> static private int counter = 0;
> String id = request.getParameter("id");
> </xsp:logic>
The "request" object is accessible _only_ inside the
"populateDocument" method (i.e. inside the user root
element). It's _not_ accessible inside the class-level
section (i.e., <xsp:logic> right beneath the root
<xsp:element>).
Note that this restriction is not specific to xsp. For
servlets, the "request" object is accessible _only_
inside the doGet/doPost/doService methods, never as
a static, class-level variable.
Re: XSL/XSP
Posted by Donald Ball <ba...@webslingerZ.com>.
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