----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------


This works for me in my servlet's service method( Apache 1.3.9 / jserv 1.1b2
/ jvm 1.2.1 on solaris ):

HttpSession distributorSession = _req.getSession( true ) ;
if ( distributorSession.isNew() ){
        distributor = new Distributor() ;               
        distributorSession.putValue(  "mysession.data", distributor) ;
}       
distributor = (Distributor)distributorSession.getValue( "mysession.data" ) ;

-----Original Message-----
From: ricardo [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 12, 1999 1:14 PM
To: [EMAIL PROTECTED]
Subject: Problems with session in JServ

Hi guys,

I'm with a problem using session in my servlet
Well, my servlet works perfectly when I run it from sun's jswdk-1.0.1,
however, when a run it from apache + jserv, the sessions just die!
I'll show you a simplified version of my problem bellow.

Note.:  No class declarations or exception handling. It's just example


public void doPost (HttpServletRequest req, HttpServletResponse resp) throws
.... {

    HttpSession ses = req.getSession (true); // My servlet start work with a
POST (login). That is why the param is set to true


}

public void doGet (HttpServletRequest req, HttpServletResponse resp) throws
.... {

    HttpSession ses = req.getSession (false); // If there's no session, it's
a bug. The guy didn't logged in

    if (ses == null) {
        res.setContentType ("text/html");
        ServletOutputStream out = res.getOutputStream ();
        out.println ("<html><head><title> ERROR </title></head><body>");
        out.println ("NAO TEM SESSAO!!!");
        out.println ("</body></html>");
        out.close ();
    }

}

Well, The session ALWAYS die between the first POST and the next requests
(either GET or POST)

If you understood my problem, and can help me, I thank you!

Ricardo Munhoz Santiago
Sun Certified Programmer for the JAVA 2 Platform



--


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to