Hi all.

        For some reason I just can't seem to get session tracking to work I
always get java.lang.NullPointerException when I call it from the WebServer.
I'm using JDK1.2 with JSDK2.1 on a Sun Java Web server 1.1.3.  I've included
an easy sample code

Thanks

Stef.


Small sample code.

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Login2 extends HttpServlet {

        private HttpSession currSession;

        public void doGet(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException {

                res.setContentType("text/html");
                PrintWriter out = res.getWriter();

                currSession = req.getSession(true);

                if (currSession==null) {
                        out.println("Ok");
                } else {
                        out.println("No");
                }
        }
        public void doPost(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException {

                doGet(req, res);
        }

}


                       ,,               Stephane DeCoeli Cote
                  `    >                InterPro Expense System
  |||                 ~             |||     w (925) 730-3717
-|||=oOOo====oOOo=|||-
  |||          \  / || \  /         |||
                 \/  ||  \/
                     / \
                    /   \
                 ~      ~
I know I can, I think I can...Bah, I think I'll go Duke Nuken instead!

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to