Title: RE: Problems with Session Handling
Hmm,
 

>> <jsp:useBean id="fred" class="com.foo" scope="session" /> syntax.

With JSP 0.92 I have to use:
<BEAN name="MyBeanName" type="xyz.MyBean" scope="session"></BEAN>
(which I think actually looks nicer than the 1.0 spec)
 
I'm not doing anything (programming) to handle sessions.
 
I'll talk about one page & bean to highlight my problem:
 
I have a Catalogue bean which looks after outputting a list of products from a MS SQL database (the Catalogue bean uses a singleton class to handle connection pooling).
 
I have one JSP page which uses the Catalogue bean:
 
<%@ import="dconn.*" %>
<BEAN name="Catalogue" type="dconn.Catalogue" scope="session"></BEAN>
<% Catalogue.processRequest(request); %>
 
In the Database all children only have one parent - so I have folders or items within a folder.  I use a "setLevel" method in the Catalogue bean to allow the JSP page drill-down the product list.  If folders are listed the JSP / HTML page uses either a A HREF link or a form action to reload the same JSP / HTML page while also passing a variable named "level" via. CGI in order to update the Catalogue bean.
 
All this works perfectly (& the above is only the basics - the Catalogue bean can also output the family tree, etc).
 
Now the funny stuff - If, on one browser on one computer, you drill down a couple of levels (a.k.a. Folders) and then open the same JSP / HTML page on another browser on another computer you will find that it goes straight to the same level as the first computer - so both browsers/computers are sharing the beans data rather than having their own unique sessions.
 
The browser do recieve a unique session cookie - so the cookie's are travelling around correctly.
 
This has to be a problem with my usage of JSP & beans as I observed the same problem with the development JSP WWW server which comes with Sun's JSDK.
 
Thanks for any help,
 
 
Derek.
 
PS.
 
Ok, ok RTFM on the previous problem with case sensitivity with the "set" bean methods when calling from a JSP page (CGI).
 
Heres another funny problem for people using the JSDK development WWW server on a machine which already has a WWW server running:
 
You cannot actually run the JSDK development WWW server on a unique IP address in one computer.  It seems to bind to all available IP addresses.  There is a directive in "default.cfg" named "server.inet=" but it appears that this is ignored.  This means that you cannot run the JSDK development WWW server on port 80 on one unique IP address while having a WWW server running on port 80 on another unique IP address within the same computer.
 
Derek :)

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Kevin Jones
Sent: Wednesday, August 04, 1999 9:10 AM
To: [EMAIL PROTECTED]
Subject: Re: Problems with Session Handling

ISTR that lifespan was a JSP 0.92 thing and scope is JSP 1.x whcih maybe your problem.

 

Derek,

 

what are you doing in JSP to handle the sessions - you say that you thought JSP would handle sessions for you - what exactly do you mean?

 

In JSP you can associate a bean with a session - in 1.0 you use the

<jsp:useBean id="fred" class="com.foo" scope="session" /> syntax.

 

Any request that comes in from the same session will 'see' this instance of the bean - requests from different sessions will all see different bean instances, each with their own data,

 

Kevin

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of krk661s
Sent: 03 August 1999 21:41
To: [EMAIL PROTECTED]
Subject: Re: Problems with Session Handling

This is how we defined our user Account bean -- it inherits from a UserAccount class. It will contain user ssn, name, etc for multiple users. When we had the code scope=session, the bean would be empty when we called another jsp and tried to reference the bean. When we changed scope=session to lifespan=session, we had no problems referencing the bean. I'm not sure if this has anything to do with your problem. <%@ page language="java" import="CUFBusiness.*" %><%@ errorpage="error.html" %>caucho.com also has many jsp examples that may be helpful. This is where we found the lifespan tag. >===== Original Message From Derek Conniffe <[EMAIL PROTECTED]>===== > > > >

> >

No, I originally >I thought the problem was because the computers (with the browsers) I was >testing with are all behind a proxy server sharing the same IP address (the >Apache/J_Serv/Gnu-jsp server is outsite the firewall on its own IP >address).  I have since tested with other computers within our class C >subnet - all their own IP's.

>

 

>

I am using as >little JSP code as possible - All the major code is in beans used by the >JSP pages - in all cases scope="session".

>

 

>

All browsers >viewing the JSP pages seem to share the one session. 

>

 

>

I'm not doing any >kind of work to handle sessions - I kinda hoped that JSP would do that for >me.

>

 

>

size=2>Thanks,

>

 

>

Derek >:)

>

style="BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px"> >

size=2>-----Original Message-----
From: Mike McElligott [ href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED] ]
Sent: > Tuesday, August 03, 1999 5:42 PM
To: 'Derek Conniffe'; href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]
Su bject: > RE: Problems with Session Handling

>

Derek,

>

Are you using the same browser?  Multiple instances of > the same browser are in the same session..  Different browsers, however, > would not be..

>

-----Original Message-----
From: Derek > Conniffe [ href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]]
size=2>Sent: Tuesday, August 03, 1999 9:18 AM
To: href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] size=2>Subject: Problems with Session Handling

>


>

Hi,

>

I started using JSP & Beans with the development www > server (with the JSP
development kit).  Beans were > used in the pages with scope="session".  I had
size=2>a problem at that time with all browers sharing the same bean > information.

>

I have now moved to Apache, JSERV & Gnu-jsp & have the > same problem.

>

Is it up to me & the Bean coding to handle sessions?  > I have simply been
hoping that the whole JSP thing > magically handles multiple [unique]
instances of beans > with unique internal private variables.

>

Thanks for any help on this!

>

Derek :)

>

size=2>======================================================================= ====
size=2>To unsubscribe, send email to href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] and include in > the body
of the message "signoff > JSP-INTEREST".  For general help, send email to
size=2>[EMAIL PROTECTED] and > include in the body of the message >"help".

Kara R. Krogh ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JSP-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to