RE: Cookies And Session Problems
Yes my problem was I was storing everything at application level thank you. Now I am storing values at session level but I'm still having problems. If I open up two clients details by right clicking on one link and opening the other clients link, the users details will overwrite one the first client. That's because in the Action class which gets the users details I call: request.getSession().setAttribute(chosenCL,client); Then when the next client is selected this will call this again and overwrite the first clients value, so pressing refresh on first page I will see the values for the second client. I suppose what I need is to store it in the scope of the page? But I'm not sure. Can anybody help me here Thanks -Original Message- From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] Sent: 09 March 2004 13:03 To: Ciaran Hanley Cc: Struts Users Mailing List Subject: Re: Cookies And Session Problems I think that i've found the problem. Please, look below : Ciaran Hanley wrote: Hi thanks for your reply, I am using form based authentication. Cookies are enabled. I am storing all session information using request.getSession() for example: request.getSession().getServletContext().setAttribute(user, loggedUser); stores the user bean in the session. Ciaran, you must use request.getSession().setAttribute( user,loggedUser ); When you use request.getSession().getServletContext().setAttribute(user, loggedUser); you're putting your bean at application scope... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
It looks like your two browser sessions are sharing the same memory used to store cookies. So your application server treats requests from both browsers as in the same session (since they send the same jsessionid cookie). In IE you used to be able to correct his by checking launch in new process in Tools|Internet Options, but I no longer see this in IE 6.0.2800.1106 If you open your site in IE and in Mozilla at the same time you will have separate sessions. BAL From: Ciaran Hanley [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED], [EMAIL PROTECTED] Subject: RE: Cookies And Session Problems Date: Wed, 10 Mar 2004 20:30:49 - Yes my problem was I was storing everything at application level thank you. Now I am storing values at session level but I'm still having problems. If I open up two clients details by right clicking on one link and opening the other clients link, the users details will overwrite one the first client. That's because in the Action class which gets the users details I call: request.getSession().setAttribute(chosenCL,client); Then when the next client is selected this will call this again and overwrite the first clients value, so pressing refresh on first page I will see the values for the second client. I suppose what I need is to store it in the scope of the page? But I'm not sure. Can anybody help me here Thanks -Original Message- From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] Sent: 09 March 2004 13:03 To: Ciaran Hanley Cc: Struts Users Mailing List Subject: Re: Cookies And Session Problems I think that i've found the problem. Please, look below : Ciaran Hanley wrote: Hi thanks for your reply, I am using form based authentication. Cookies are enabled. I am storing all session information using request.getSession() for example: request.getSession().getServletContext().setAttribute(user, loggedUser); stores the user bean in the session. Ciaran, you must use request.getSession().setAttribute( user,loggedUser ); When you use request.getSession().getServletContext().setAttribute(user, loggedUser); you're putting your bean at application scope... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Store more e-mails with MSN Hotmail Extra Storage 4 plans to choose from! http://click.atdmt.com/AVE/go/onm00200362ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies And Session Problems
Ciaran, Brian is right. Using IE, you can get a different session if you try to execute a new instance of IE (do not use Open a new window). But you must be carefull because even the links in Windows' startup menu can just Open a new window (instead starts a new IE instance). When you are using Netscape/Mozilla, try to use 2 different profiles (again, Open a new Window will make Netscape or Mozilla share the stored cookies). I hope this helps you. Brian Lee wrote: It looks like your two browser sessions are sharing the same memory used to store cookies. So your application server treats requests from both browsers as in the same session (since they send the same jsessionid cookie). In IE you used to be able to correct his by checking launch in new process in Tools|Internet Options, but I no longer see this in IE 6.0.2800.1106 If you open your site in IE and in Mozilla at the same time you will have separate sessions. BAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
Ok but my problem is right throughout my application still even when only logged in as one user. Say I am a client who logs in and views a list of their customers. I want to view customer x, customer y, and customer z values to compare them. So I right click on these three links and open them in new windows. They all open fine, but If I hit refresh on one of them, the details of the most recently retrieved customer will be seen. This is because like in the action class as before I call request.getSession().setAttribute(chosenCU,customer); And on the jsp I use bean:write name=chosenCU property=cuID / bean:write name=chosenCU property=cuName / etc. for other properties So it gets the chosenCU object in session scope and displays it. I only want to display the customer that is relevant to the page. Can this be done with some sort of page scope or something? Thanks -Original Message- From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] Sent: 10 March 2004 21:39 To: Struts Users Mailing List Subject: Re: Cookies And Session Problems Ciaran, Brian is right. Using IE, you can get a different session if you try to execute a new instance of IE (do not use Open a new window). But you must be carefull because even the links in Windows' startup menu can just Open a new window (instead starts a new IE instance). When you are using Netscape/Mozilla, try to use 2 different profiles (again, Open a new Window will make Netscape or Mozilla share the stored cookies). I hope this helps you. Brian Lee wrote: It looks like your two browser sessions are sharing the same memory used to store cookies. So your application server treats requests from both browsers as in the same session (since they send the same jsessionid cookie). In IE you used to be able to correct his by checking launch in new process in Tools|Internet Options, but I no longer see this in IE 6.0.2800.1106 If you open your site in IE and in Mozilla at the same time you will have separate sessions. BAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
Indeed. Saving objects in session is best left for information that will be frequently accessed about the user who's logged on, not any of the application-specific data they're interacting with (ideally, at least). You should pass the customer x value through either a request/URL parameter or request attribute to avoid scope overlaps. -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 4:56 PM To: 'Struts Users Mailing List'; [EMAIL PROTECTED] Subject: RE: Cookies And Session Problems Ok but my problem is right throughout my application still even when only logged in as one user. Say I am a client who logs in and views a list of their customers. I want to view customer x, customer y, and customer z values to compare them. So I right click on these three links and open them in new windows. They all open fine, but If I hit refresh on one of them, the details of the most recently retrieved customer will be seen. This is because like in the action class as before I call request.getSession().setAttribute(chosenCU,customer); And on the jsp I use bean:write name=chosenCU property=cuID / bean:write name=chosenCU property=cuName / etc. for other properties So it gets the chosenCU object in session scope and displays it. I only want to display the customer that is relevant to the page. Can this be done with some sort of page scope or something? Thanks -Original Message- From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] Sent: 10 March 2004 21:39 To: Struts Users Mailing List Subject: Re: Cookies And Session Problems Ciaran, Brian is right. Using IE, you can get a different session if you try to execute a new instance of IE (do not use Open a new window). But you must be carefull because even the links in Windows' startup menu can just Open a new window (instead starts a new IE instance). When you are using Netscape/Mozilla, try to use 2 different profiles (again, Open a new Window will make Netscape or Mozilla share the stored cookies). I hope this helps you. Brian Lee wrote: It looks like your two browser sessions are sharing the same memory used to store cookies. So your application server treats requests from both browsers as in the same session (since they send the same jsessionid cookie). In IE you used to be able to correct his by checking launch in new process in Tools|Internet Options, but I no longer see this in IE 6.0.2800.1106 If you open your site in IE and in Mozilla at the same time you will have separate sessions. BAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies And Session Problems
In this case you should not set the data in the session. Set it on the form and set the form to request scope. This will prevent the refresh problem you are seeing. BAL - Original Message - From: Ciaran Hanley [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, March 10, 2004 4:55 PM Subject: RE: Cookies And Session Problems Ok but my problem is right throughout my application still even when only logged in as one user. Say I am a client who logs in and views a list of their customers. I want to view customer x, customer y, and customer z values to compare them. So I right click on these three links and open them in new windows. They all open fine, but If I hit refresh on one of them, the details of the most recently retrieved customer will be seen. This is because like in the action class as before I call request.getSession().setAttribute(chosenCU,customer); And on the jsp I use bean:write name=chosenCU property=cuID / bean:write name=chosenCU property=cuName / etc. for other properties So it gets the chosenCU object in session scope and displays it. I only want to display the customer that is relevant to the page. Can this be done with some sort of page scope or something? Thanks -Original Message- From: Daniel Henrique Alves Lima [mailto:[EMAIL PROTECTED] Sent: 10 March 2004 21:39 To: Struts Users Mailing List Subject: Re: Cookies And Session Problems Ciaran, Brian is right. Using IE, you can get a different session if you try to execute a new instance of IE (do not use Open a new window). But you must be carefull because even the links in Windows' startup menu can just Open a new window (instead starts a new IE instance). When you are using Netscape/Mozilla, try to use 2 different profiles (again, Open a new Window will make Netscape or Mozilla share the stored cookies). I hope this helps you. Brian Lee wrote: It looks like your two browser sessions are sharing the same memory used to store cookies. So your application server treats requests from both browsers as in the same session (since they send the same jsessionid cookie). In IE you used to be able to correct his by checking launch in new process in Tools|Internet Options, but I no longer see this in IE 6.0.2800.1106 If you open your site in IE and in Mozilla at the same time you will have separate sessions. BAL - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
If you mean in the action mappings then no, I have the scope set to request for each mapping. Ciaran -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: 09 March 2004 03:26 To: Struts Users Mailing List Subject: RE: Cookies And Session Problems Did you accidentally set the scope of the FormBean for your Action to application instead of session or request? Regards, David -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 7:48 PM To: Struts User Mailing List Subject: Cookies And Session Problems Hey, I am writing an app but am having session problems. The last user to log into the system has their details available to all other users logged in. I haven't much of an idea about session control can anybody give some pointers in the right direction? From reading I am thinking url rewriting is the way to go about it, but cant find any good code snippets to get me started. Also, if caching is disabled does this mean that cookies won't be stored on the hard drive? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies And Session Problems
I think that i've found the problem. Please, look below : Ciaran Hanley wrote: Hi thanks for your reply, I am using form based authentication. Cookies are enabled. I am storing all session information using request.getSession() for example: request.getSession().getServletContext().setAttribute(user, loggedUser); stores the user bean in the session. Ciaran, you must use request.getSession().setAttribute( user,loggedUser ); When you use request.getSession().getServletContext().setAttribute(user, loggedUser); you're putting your bean at application scope... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies And Session Problems
As a general point life gets less confusing when you retrieve you objects one at a time rather than drilling through several at once.. When you get used to using stuff on a daily basis then of course you're going to start opting for one line rather than several. but IMO you better thinking/coding like this until you get used to messing with these things. HttpSession session = request.getSession(); session.setAttribute(foo,bar); if you wanted t o get to the application scope to shortest way in an actions would be ServletContext context = getServlet().getServletContext(); or words to that effect. Might be an egg sucking lesson but seems to be this trendy coding style thats confusing you. So could very well be useful. HTH mark On 9 Mar 2004, at 14:15, Daniel Henrique Alves Lima wrote: I think that i've found the problem. Please, look below : Ciaran Hanley wrote: Hi thanks for your reply, I am using form based authentication. Cookies are enabled. I am storing all session information using request.getSession() for example: request.getSession().getServletContext().setAttribute(user, loggedUser); stores the user bean in the session. Ciaran, you must use request.getSession().setAttribute( user,loggedUser ); When you use request.getSession().getServletContext().setAttribute(user, loggedUser); you're putting your bean at application scope... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Cookies And Session Problems
I think that i've found the problem. Please, look below : Ciaran Hanley wrote: Hi thanks for your reply, I am using form based authentication. Cookies are enabled. I am storing all session information using request.getSession() for example: request.getSession().getServletContext().setAttribute(user, loggedUser); stores the user bean in the session. Ciaran, you must use request.getSession().setAttribute( user,loggedUser ); When you use request.getSession().getServletContext().setAttribute(user, loggedUser); you're putting your bean at application scope... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Cookies And Session Problems
Hey, I am writing an app but am having session problems. The last user to log into the system has their details available to all other users logged in. I haven't much of an idea about session control can anybody give some pointers in the right direction? From reading I am thinking url rewriting is the way to go about it, but cant find any good code snippets to get me started. Also, if caching is disabled does this mean that cookies won't be stored on the hard drive? Thanks
Re: Cookies And Session Problems
The last user to log into the system has their details available to all other users logged in. Be really specific about you mean here, and give a few details about the deployment environment. - What session information appears to be shared by the users? - Can you demonstrate the session problem in a simple example that does not involve security in any way? One user hits page that puts something in session, second user hits page that puts something in session, first user can see second user's crap on a page that shows contents of the session. Something like that. - If not, are you using container-managed security (as defined in the servlet spec) or something else? - Is there a web server between the users and the app server? -Max - Original Message - From: Ciaran Hanley [EMAIL PROTECTED] To: Struts User Mailing List [EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:48 PM Subject: Cookies And Session Problems Hey, I am writing an app but am having session problems. The last user to log into the system has their details available to all other users logged in. I haven't much of an idea about session control can anybody give some pointers in the right direction? From reading I am thinking url rewriting is the way to go about it, but cant find any good code snippets to get me started. Also, if caching is disabled does this mean that cookies won't be stored on the hard drive? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
Basically there is only one session being maintained for all users. So If user joe logs in and is viewing client a, and along comes a second user jack who views client b, on refreshing the page joe will have jacks profile and will now see user b details as his details were the last chosen and stored in the session. I'm using the MVC pattern, apache web server but no application server. It's being developed with Struts, Tomcat and MySQL database. Just cant find anything to help me figure this out so far. Suggestions welcome Thanks Ciaran -Original Message- From: Max Cooper [mailto:[EMAIL PROTECTED] Sent: 09 March 2004 02:19 To: Struts Users Mailing List Subject: Re: Cookies And Session Problems The last user to log into the system has their details available to all other users logged in. Be really specific about you mean here, and give a few details about the deployment environment. - What session information appears to be shared by the users? - Can you demonstrate the session problem in a simple example that does not involve security in any way? One user hits page that puts something in session, second user hits page that puts something in session, first user can see second user's crap on a page that shows contents of the session. Something like that. - If not, are you using container-managed security (as defined in the servlet spec) or something else? - Is there a web server between the users and the app server? -Max - Original Message - From: Ciaran Hanley [EMAIL PROTECTED] To: Struts User Mailing List [EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:48 PM Subject: Cookies And Session Problems Hey, I am writing an app but am having session problems. The last user to log into the system has their details available to all other users logged in. I haven't much of an idea about session control can anybody give some pointers in the right direction? From reading I am thinking url rewriting is the way to go about it, but cant find any good code snippets to get me started. Also, if caching is disabled does this mean that cookies won't be stored on the hard drive? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Cookies And Session Problems
Did you accidentally set the scope of the FormBean for your Action to application instead of session or request? Regards, David -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 7:48 PM To: Struts User Mailing List Subject: Cookies And Session Problems Hey, I am writing an app but am having session problems. The last user to log into the system has their details available to all other users logged in. I haven't much of an idea about session control can anybody give some pointers in the right direction? From reading I am thinking url rewriting is the way to go about it, but cant find any good code snippets to get me started. Also, if caching is disabled does this mean that cookies won't be stored on the hard drive? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]