Hi,

I will like to add here that getSession(true) does not create a new session
if a *Valid* session exists for the request.
If you want to know if the session created is new or not you can use the API
function

HttpSession.isNew() which returns a boolean. (API for more details)

If you are using the session object to store an Attribute and then forward
to some other servlet on the first request(i.e. the session is new  see spec
2.2  sec 7.2) then this philosophy will fail. For passing the request to
another servlet you can use the method HttpServletRequest.setAttribute.

If this is not the case then u need to explore why is the session not being
returned by the client.(it might be that the client does not accept cookies)
If on the subsequent requests, the container does not receive the session
id, it will create a new session id for you. May be ur client does not
handle Cookies. Try the method HttpServletResponse.encodeURL on all the
links to the next servlet. This might solve ur problem, if it is due to the
client.

regds,
Gokul


> Hi everybody
>
> I think this can solve your little problem :
>
> Get the session with the boolean parameter equals false, so get the
session if
> exists and it doesn't create a new session if there isn't any session
alive.
>
> if ( HttpSession session == req.getSession( false ) )
> {
> // get Session
> }
> else
> {
>  // There isn't any session : return error page
> }
>
>
>
> 04/09/2000 10:20 PM
> Alarcon Fabio <[EMAIL PROTECTED]>
>
>
> Por favor, responda a "A mailing list for discussion about Sun
Microsystem's
>       Java              Servlet API Technology."
<[EMAIL PROTECTED]>
>
> Destinatarios: [EMAIL PROTECTED]
> CC:        (cci: Martin De Miguel Lillo/UN19159/DESARROLLO DE
SISTEMAS/TSM)
> Asunto:   About session
>
>
>
> Hi firends
> I need to save some session data to use in another servlet, but
> when I get  the session object in the second servlet it creates
> another one, so I can't get the saved values from previous servlet.
> Can abybody suggest something please, maybe any configuration
> trick? I work with Apache and Jserv (JSDK2.1) in Linux
> Thanks in advance
> Best regards
>
> Fabio
> Fabio Alarcon Ortiz
>
> Seguro Social de Salud
> Gerencia Central de Desarrollo e Informatica
> Gerencia de Sistemas
> Phones : (51 1) 265 6000, 265 7000 Extensions 2356, 2357
> Mobile : (51 1) 855 1393
> ICQ    : 11002875
> email  : [EMAIL PROTECTED], [EMAIL PROTECTED]
>
>
___________________________________________________________________________
> 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
>
>
___________________________________________________________________________
> 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

___________________________________________________________________________
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