You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jon Brisbin <br...@ipa.net> on 2001/02/24 17:57:41 UTC

the xsp session stuff

I'm having trouble using the XSP session objects.  It appears that there is
no checking to handle the first use of a session, when none exists yet.  If
I try to access anything with the session object, I get a
NullPointerException.  Where do I need to edit my code to have it do a
getSession(true) so it will create a session to use??

Thanks!

Jon Brisbin
www.jbrisbin.net


Re: the xsp session stuff

Posted by Matthew Cordes <mc...@maine.edu>.
hi,

<xsp:page
    ...
    ...
    create-session="true"
>

if memory serves me, I'm sure someone will correct me if this isn't correct.

-matt

----- Original Message -----
From: "Jon Brisbin" <br...@ipa.net>
To: "Cocoon-Users@Xml. Apache. Org" <co...@xml.apache.org>
Sent: Saturday, February 24, 2001 11:57 AM
Subject: the xsp session stuff


> I'm having trouble using the XSP session objects.  It appears that there
is
> no checking to handle the first use of a session, when none exists yet.
If
> I try to access anything with the session object, I get a
> NullPointerException.  Where do I need to edit my code to have it do a
> getSession(true) so it will create a session to use??
>
> Thanks!
>
> Jon Brisbin
> www.jbrisbin.net
>
>
> ---------------------------------------------------------------------
> 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: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>


Re: the xsp session stuff

Posted by Klaus Drechsler <dr...@gmx.net>.
At 17:57 24.02.2001, you wrote:
>I'm having trouble using the XSP session objects.  It appears that there is
>no checking to handle the first use of a session, when none exists yet.

You could do the following:

HttpSession mySession = request.getSession(false);


This will get you the Session-Object if a valid session is there somewhere 
around :-)
Else "mySession" is null.

So if you try to access the session-object you shoul check if it is null or 
nor:

if(mySession!=null){
         // Do something
}else{
         // Do something
}


ciao,
  Klaus
-- 
Farewell! I will omit no opportunity
That may convey my greetings, love, to thee.
                                   Romeo&Juliet
                         (Act III, Scene V)
---------------------------------------------
PGP-Key: http://pgp.kdnet.de (soon!)
---------------------------------------------