cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: xsp-request problem
Date Mon, 04 Mar 2002 17:12:17 GMT
Hi Istvan,

Your XSP is not valid. Any xsp:logic tag which comes before first
document tag goes to the XSP class definition, not to the XSP method
body. So your tag defines string member of the class "fruit" with
initializer. Initializer you specified requires request object. At the
time of instance creation this request object is obviously missing.
Hence, you got NullPointerException.

The correct XSP (assuming you are using Cocoon 2) is:

---------------------8<-------------------
<?xml version="1.0"?>

<xsp:page xmlns:xsp="http://apache.org/xsp"
          xmlns:xsp-request="http://apache.org/xsp/request/2.0">

  <html>
    <xsp:logic>
      String fruit = <xsp-request:get-parameter name="fruit"/>;
    </xsp:logic>

    <b>The string is: </b>
    <xsp:expr>fruit</xsp:expr>
    <br/>
    <b>The request parameter is: </b>
    <xsp-request:get-parameter name="fruit"/>
  </html>
</xsp:page>
---------------------8<-------------------

Regards,
Vadim


> -----Original Message-----
> From: Michael Homeijer [mailto:M.Homeijer@devote.nl]
> Sent: Monday, March 04, 2002 9:34 AM
> To: 'cocoon-users@xml.apache.org'
> Subject: RE: xsp-request problem
> 
> Hi,
> 
> Have a look at the generated java code in the work directory of your
servlet
> engine.
> I am sure it will give you a clue about how XSP works in Cocoon. ;-)
> 
> Michael
> 
> > -----Original Message-----
> > From: Istvan Beszteri [mailto:istvan.beszteri@hut.fi]
> > Sent: maandag 4 maart 2002 16:35
> > To: cocoon-users@xml.apache.org
> > Subject: xsp-request problem
> >
> >
> > Hi All,
> >
> > I just started to learn XSP and I tried some examples.
> > I have found a strange problem with xsp-request.
> >
> > The following xsp works properly:
> >
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <xsp:page
> >     xmlns:xsp="http://apache.org/xsp"
> >     xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> > >
> >     <xsp:logic>
> >         String fruit = "apple";
> >     </xsp:logic>
> >
> >     <html>
> >        <b>The string is: </b><xsp:expr>fruit</xsp:expr>
> >        <br/>
> >        <b>The request parameter is: </b>
> > <xsp-request:get-parameter
> > name="fruit"/>
> >     </html>
> > </xsp:page>
> >
> > with a certain request, but if I try to give value to the
> > fruit string as in
> > the following example, I get a null pointer exception:
> >
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <xsp:page
> >     xmlns:xsp="http://apache.org/xsp"
> >     xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> > >
> >     <xsp:logic>
> >         String fruit = <xsp-request:get-parameter name="fruit"/>;
> >     </xsp:logic>
> >
> >     <html>
> >        <b>The string is: </b><xsp:expr>fruit</xsp:expr>
> >        <br/>
> >        <b>The request parameter is: </b> <xsp-request:get-parameter
> > name="fruit"/>
> >     </html>
> > </xsp:page>
> >
> > It seems <xsp-request:get-parameter name="fruit"/> gives back
> > a null pointer
> > if I use it within the <xsp:logic> tags.
> >
> > Any idea?
> >
> > Thanks in advance!
> >
> > Istvan
> >


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message