----------------------------------------------------------------
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!!!
----------------------------------------------------------------


Hi,

I am not sure that i am corect but i allways use session like this:

/*
looking for an allready created session
*/
HttpSession session=req.getSession(false);
if(session==null) session=req.getSession(true); /*create the session*/


I think that calling req.getSession(true) will create a new session.
Am i wrong ??

Best wishes,
                Andras.





----- Original Message -----
From: Krister Bruhwel <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 22, 2000 6:23 PM
Subject: session tracking


> ----------------------------------------------------------------
> 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!!!
> ----------------------------------------------------------------
>
> Hello,
> I'm trying to session track for password verification.  I'm trying to
> save information between servlets with session tracking, but my values
> are not read between the servlets.  I'm trying something like what is
> shown below:
>
> +Servlet Data ---------------------------------------------
> file://Main file that has the program, we first check to see if the user
has
> logged on.
>    HttpSession session = req.getSession(true);
>    Object done = session.getValue("logon.isDone");
>   if (done == null) {
>     session.putValue("login.target",
>   HttpUtils.getRequestURL(req).toString()) ;
>   file://login target is saved and we redirect for password verification
>   res.sendRedirect(req.getScheme() + "://" + req.getServerName() + ":"
>                                        + req.getServerPort() +
>                                        "/servletLogin.html");
>   return;
> }
> file://rest of code here
> +----------------------------------------------------
>
> +Servlet Login Handler--------------------------------------
> file://login handler
> file://code after verifying password is ok
>    HttpSession session = req.getSession(true);
>   session.putValue("login.isDone", name);
>   try {
>             String target = (String) session.getValue("login.target");
>             if (target != null)
>                res.sendRedirect(target);
>             return;
>           }
>           catch (Exception ignored) {}
>           res.sendRedirect(req.getScheme() + "://" +
>                            req.getServerName() + ":" +
>                            req.getServerPort() +
>                            "/index.html");
> }
> +----------------------------------------------------
>
> I loose my login.target data and my login.isDone values between
> Redirect()'s.  I have made versions that spit out the variables the
> screen, and unless the  servlet that sets the variable is running at
> time, the value is null.  I have searched on the web a bunch, and I
> can't fiqure out whats wrong.  I'm using Red hat 6.0, Jserv1.1, and I'm
> not sure what Apache version (how do I tell).  The Apache came with Red
> Hat 6.0. Any help or pointers to help would be
> great.
>
> Thanks,
> Krister
>
>
> --
> --------------------------------------------------------------
> 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]



--
--------------------------------------------------------------
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