Title: Why is HttpServletRequest.getSession(true) throws null on JWS

Hi.

        I just can't seem to get session to work.  The even looked at the server.properties files and enable.session=true, I'm missing the boat somewhere.  getSession seems to throw a null exception.

Stef

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

public class test extends HttpServlet {

        public void doGet (HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException
        {
                //Get the session object
                try {
                        HttpSession session = req.getSession(true);
                } catch (Exception e) {
                        res.setContentType("text/html");
                        PrintWriter out = res.getWriter();
                        out.println(e.getMessage());
                }
        }
        public void doPost(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException {
                doGet(req, res);
        }
}

Reply via email to