Session does not end even when i close browser
when i close firefox/IE the session continues ,What i need is that i am adding amount in shopping cart ,but the amount adds to old amount even when i open a new browser window ,
i hv checked that my browser will remove cookies when i will close mozilla
i hv also printed total=0 in servlet's ini method but the init method is called only once and total does not reset to 0,does 'th the call to init method is made everytime we start a new session via browser ,it does not get called whn i close the current browser and open new one.how to destroy the older servlet?
I m using s=request.getSession()
and s.setAttribute("billamnt",total)
the code of the servlet is
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class addtocart extends HttpServlet
HttpSession s;
PrintWriter pw;
int total,cam,mob;
public void init()
total=0;
cam=0;
mob=0;
System.out.println("inside cart init");
public void service(HttpServletRequest req,HttpServletResponse res) throws IOException
s=req.getSession();
res.setContentType("text/html");
pw=res.getWriter();
pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
if(req.getParameter("csony")!=null)
cam=cam+Integer.parseInt(req.getParameter("csony"));
if(req.getParameter("clg")!=null)
cam=cam+Integer.parseInt(req.getParameter("clg"));
if(req.getParameter("cnokia")!=null)
mob=mob+Integer.parseInt(req.getParameter("cnokia"));
if(req.getParameter("cerricson")!=null)
mob=mob+Integer.parseInt(req.getParameter("cerricson"));
s.setAttribute("cambill",new Integer(cam));
s.setAttribute("mobbill",new Integer(mob));
s.setAttribute("billamnt",new Integer(cam+mob));
public void doPost(HttpServletRequest req,HttpServletResponse res)
public void doGet(HttpServletRequest req,HttpServletResponse res)
}Wats the problem?
Message was edited by:
pooja_k_online
The servlet is not created on a session basis. All users share the same servlet object. The servlet is created once when the servlet is first called in the context, then is maintaned until the server shuts down.
You should not store any state in the servlet. You should use the HttpSession object you get from the request object to store the totals, and all other values. You should not use the servlet to hold on to a session object, as multiple users would see the SAME session that way. If you need to use the session in multiple methods, then you should pass that object as parameter, not by making it a class member.
You also shouldn't put the work in the service method of the HttpServlet. You should put it in either the doGet or doPost method (and if you want to make it happen for both type requests, call doPost from the doGet method and put the work in the doPost method).
For example:
public class ShoppingCartServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) {
doPost(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
Integer cambill = (Integer)session.getAttribute("cambill");
int cam = 0;
if(cambill != null) cam = cambill.intValue();
Integer mobbill = (Integer)session.getAttribute("mobbill");
int mob = 0;
if(mobbill != null) mob = mobbill.intValue();
Integer billamnt = (Integer)session.getAttribute("billamnt");
int total = 0;
if(billamnt != null) total = billamnt.intValue();
String csony = request.getParameter("csony");
if (csony != null) cam += Integer.parseInt(csony);
String clg = request.getParameter("clg");
if (clg != null) cam+= Integer.parseInt(clg);
String cnokia = request.getParameter("cnokia");
if (cnokia != null) mob += Integer.parseInt(cnokia);
String cerricson = request.getAttribute("cerricson");
if (cerricson != null) mob += Integer.parseInt(cerricson);
total = cam + mob;
session.setAttribute("cambill",new Integer(cam));
session.setAttribute("mobbill",new Integer(mob));
session.setAttribute("billamnt",new Integer(total));
PrintWriter pw=response.getWriter();
pw.println("<html><body><a href="+"mobs"+">Mobile</a><br><a href="+"cams"+">Camera</a><form method = "+"post "+"action ="+"bill"+"><br><input type= "+"submit"+"></form></body></html>");
pw.close();
}Message was edited by:
stevejluke
Similar Messages
-
we have a server and all of use the server's url to work on it. when i log out from the application, the session with the server doesnt end.
mailto : [email protected]If the old ID is yours, and if your current ID was created by editing the details of this old ID (rather than being an entirely new ID), go to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID. Click edit next to the primary email account, change it back to your old email address and save the change. Then edit the name of the account to change it back to your old email address. You can now use your current password to turn off Find My iDevice, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll. When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud). Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was. Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.
-
Firefox automatically loaded a new version recently. The new version does not shut down when I close the browser it continues running in the background. In addition it opens Adobe Reader for a brief time and then that closes. Everything worked fine before this new version.
See "Hang at exit":
* http://kb.mozillazine.org/Firefox_hangs
* https://support.mozilla.com/kb/Firefox+hangs -
I am in Muse 2014.3. When I edit a page, in the preview everything looks fine, but when I upload it to FTP, the page does not change, even when I upload the whole site. Is this a bug? I don't know what to do.
Hi Jaap,
Are you sure about your FTP credentials (FTP folder and site URL) that you are using for the upload? Are you able to see the updated files in the remote directory of the FTP server, after you finish uploading the muse file, using an external FTP client like FileZilla?
Thanks
-Prashanth -
Execution does not end even after all records updated..
Hi,
I have plsql code like :
declare
begin
for x in ( select .......) loop -- about 4000 times
for y in ( select ............) loop -- about 50 times
end loop;
-- some code goes here to manipulate clob data
-- like creating free temp clobs - use - then free them
-- Update statement that update some table using clob values.
insert into tablex values(sysdate);
commit;
end loop;
end;
Here I can monitor from other window howmany records are inserted into tablex and howmany updated in update statement by...
select count(1) from tablex;
After 50 mins i can see that all records are updated but...
plsql code does not end its execution it continues even after all records are updated..untill i have to kill the session or let be run for long time.. :(
I can not understand why this it is not ending execution..
What could be the problem ...Hi,
Here it is.....
declare
v_text_data TableA.text_data%type;
v_clob clob;
type dummyclob_t is table of clob index by binary_integer;
dummyclob dummyclob_t;
v_str varchar2(255) := 'ddfsajfdkeiueimnrmrrttrtr;trtkltwjkltjiu4i5u43iou43i5u4io54urnmlqwmreqwnrewmnrewmreqwnm,rewqnrewqrewqljlkj';
begin
select data bulk collect into dummyclob from sfdl_clob; -- five rows containing clob data upto 1MB
for x in (select object_id
from TableA
where object_type = 'STDTEXT' ) loop
dbms_lob.createtemporary(v_text_data,TRUE);
for y in (select '<IMG "MFI_7579(@CONTROL=' || ref_id || ',REF_ID=' || ref_id || ').@UDV">' temp_data
from TableB
where object_id = x.object_id) loop
v_text_data := v_text_data ||
case
when trunc(dbms_random.value(0,7)) = 0
then chr(10)
else v_str
end ||
y.temp_data;
end loop;
select text_data into v_clob from TableA where object_id = x.object_id for update;
if v_text_data is not null then
dbms_lob.append(v_clob,v_text_data);
end if;
dbms_lob.append(v_clob,dummyclob(trunc(dbms_random.value(1, 6))));
dbms_lob.freetemporary(v_text_data);
insert into xyz values (sysdate);
commit;
end loop;
end;
Thanks for your time..:)
Rushang. -
SM04 Session does not end..Any Idea?
Hi all,
I noted that SAP R/3 session does not automatically ended after a user logs off from the ESS Frontend. This will result in a increase in session in SM04 eventhough the users had logout from the portal.
I have adjusted some timeout parameter in transaction RZ10 in R/3 including rdisp/plugin_auto_logout and restarted the services. To test, i accessed the ESS Portal and access some IAC IVIEW. Thereafter, i logged off the portal and observed the session created in R/3 (SM04) and noted that the session including the RFC connections are not released at all.
Anyone face this issue before? How can i control so that after the user logoff from the portal, the session in SM04 is end.
Thanks in advanceHi Sukanta,
I found some note on the session which i attached below. However in my EP server have dozens of web.xml. Which one should i configure? Would you able to help me on this?
Specifying HTTP Session Timeout
Use
You can specify a timeout period for HTTP sessions created in your Web application. If the session is inactive for this timeout period, it is invalidated by the Web container.
If you do not specify such a timeout explicitly, a default one of 30 minutes is assumed.
You can configure the HTTP session timeout using the web.xml descriptor.
Procedure
On the web.xml screen, proceed as follows:
1. Open the General screen.
2. To specify the timeout period, enter a value in the Session configuration Session timeout field.
The value is specified in minutes. If you enter a negative value in this field, HTTP sessions are never terminated because of a timeout. Instead, only an explicit logout by the user will terminate the corresponding session. -
SM04 Session does not end.
Hi all,
I noted that SAP R/3 session does not automatically ended after a user logs off from the ESS Frontend. This will result in a increase in session in SM04 eventhough the users had logout from the portal.
I have adjusted some timeout parameter in transaction RZ10 in R/3 including rdisp/plugin_auto_logout and restarted the services. To test, i accessed the ESS Portal and access some IAC IVIEW. Thereafter, i logged off the portal and observed the session created in R/3 (SM04) and noted that the session including the RFC connections are not released at all.
Anyone face this issue before? How can i control so that after the user logoff from the portal, the session in SM04 is end.
Thanks in advanceHi Sean,
I found some note on the session which i attached below. However in my EP server have dozens of web.xml. Which one should i configure? Would you able to help me on this? Some of my IAC view does not end while some do. Any idea on that?
Specifying HTTP Session Timeout
Use
You can specify a timeout period for HTTP sessions created in your Web application. If the session is inactive for this timeout period, it is invalidated by the Web container.
If you do not specify such a timeout explicitly, a default one of 30 minutes is assumed.
You can configure the HTTP session timeout using the web.xml descriptor.
Procedure
On the web.xml screen, proceed as follows:
1. Open the General screen.
2. To specify the timeout period, enter a value in the Session configuration Session timeout field.
The value is specified in minutes. If you enter a negative value in this field, HTTP sessions are never terminated because of a timeout. Instead, only an explicit logout by the user will terminate the corresponding session. -
My touch pad does not work only when I use Safari browser online. The screen was grey. No matter what I do, there is no reponse. Only the web address box works. What is this problem? I can use App Store and everything else fine.
Someone please help.
ThanksI would try:
- Resetting the iPod:
Reset iPod touch: Press and hold the On/Off Sleep/Wake button and the Home
button at the same time for at least ten seconds, until the Apple logo appears.
- Go to Settings>Safari and delete cache, history and cookies. -
Admin Console does not appear even when tweak applied (SJSAS 9.1 Update 1
Sun Java SystemApplication
Server 9.1 Update 1
Using the �Start� menu in Windows. This starts Firefox with the request �http://localhost:4848�.
This changes to : http://localhost:4848/asadmin/admingui/TopFrameset which gives a response of :
HTTP Status 404 -
description The requested resource () is not available.
TWEAK
Somehow I found I had the following request which I tried: http://localhost:4848/login.jsf
This gives the login screen but when I enter the admin user name and password I get the requested () resource is not available. Invalid usernames and passwords get rejected.
I have changed the asadmin password just to make sure that I know the correct username and password.
Ports are all correct. I can deploy and run a �war� file.
I have followed the following instructions in the release notes:
Description
On Windows, immediately after installing Application Server Enterprise Edition, theMessage
Queue broker fails on startup with a message saying the directory
drive:\as\domains\domain1\imq does not exist.
Note that if the broker is started after starting domain1, the directory will be created by the
Application Server and the problem will not occur.
Solution
1. Create the var_home_dir_location before creating the broker:
$imqbrokerd -varhome var_home_dir_location
For example:
$imqbrokerd -varhome D:\as\domains\domain1\imq
Any help would be appreciated.
Edited by: jdraven on Feb 27, 2008 11:08 PMHi,
That was the TWEAK I mentioned. It did not work for me. However I have no added a second hard disk and prompted by your post gave Glassfish another chance. Lo and behold it busrt into life. So thanks for your interest.
Cheers,
JohnR -
JMS session is not closed even after calling close()
Hi All,
I am using JMS to receive and publish topics for a process,in my java code i
am creating new JMS Session on demand(ie., whenever a new topic is
received) after processing the topic i am closing the session with close(),but
still the session is not closed.In a period of time more sessions are created
and FD leaks occurs which stops the process functionality.
Later i moved the on demand session code to a static block, its working fine
and no FD leak occurs.
Is this a known behavior or any java bug is there to point this issue,please
help me regarding this.
Thanks,
Ants BalajeiYou should try avoid creating sessions on demand but cache/pool them...
http://activemq.apache.org/how-do-i-use-jms-efficiently.html
James
http://www.iona.com/
Open Source the Enterprise Way -
I currently have a Mac, version 10.5.8. My Firefox had been running slow so I tried to download the latest version. When it had downloaded, a message popped up saying that this version of Firefox is not compatible with my system. Well, 'no harm no foul' I figured and I tired to go back to my previous browser.
But when I went to click on it, there was a large circle with a line through it. I couldn't open anything. Firefox had effectively been deleted from my computer.
Now it's ok if I can't run Firefox anymore but I had thousands of bookmarks, compiled over years that I would really like back. And I have no idea how to do that.
Any help would be greatly appreciated.The last version of Firefox available for OSX 10.5 was Firefox 16. Firefox versions 17-20 require OSX 10.6, 10.7 or 10.8 as well as an Intel processor (which you have).
*System requirements Firefox 20 - https://www.mozilla.org/en-US/firefox/20.0/system-requirements/
Running an old version of your OS is dangerous and makes your system vulnerable to attack by hackers. Visit the Apple site to see about upgrading to a newer major version of OSX.
Using an old version of any internet-facing application on the internet makes your system vulnerable. You should always keep your system completely up to date. -
Hi,
I have a peculiar thing happening in my RFC scenario.
I make a RFC call from my ISU system to the CRM system.Once my FM returns back to ISU ,the RFCUSER session in CRM still remains active keeping locked the value I used in the RFC.
This prevents my second update on the same object giving error "Entity already locked by RFCUSER".
One thing to mention : I am using a BAPI TRANSACTION COMMIT in the RFC with wait = X.Could it be beacause of this or is this any basis related issue?
Any help is appreciated.
Regards,
SulakshanaHi,
try using function module RFC_CONNECTION_CLOSE to close the connection to the other system (after the call for BAPI_TRANSACTION_COMMIT). The connection is usually kept open (i.e. the session is kept) so that follow up rfc-calls within the same context in System A run in the same user context in System B.
Hope that helps.
Best Regards
Michael -
Adobe Flash does not work, even when enabled.
The Adobe Flash plugin doesn't seem to work. Well, it's there but doesn't show any Flash content. In other words, it just shows the background of the site (or blank). Sites are able to detect Flash if it's disabled. No other addons or plugins are interfering with it. I can't update Firefox or Flash.
Hi,
In summary
* check IE works with Flash content at present
* download and install Firefox 14+
* uninstall Flash 11.3 and install Flash 10.3
* post back with how you get on
* note these are temporary workarounds until developers fix the problems.<br> Whilst these problems exist upgrading FlashPlayer as advised by Adobe Flash, or by Firefox's pluginchecker may not be a good idea.
First of all I note you seem to be using the old Firefox 5. That is no longer supported and is not secure. I would suggest you update to Firefox 14 either by using the menu option
* Help -> About Firefox ->Upgrade
* or by visiting http://www.mozilla.org/en-US/firefox/all.html
Secondly note there may be some problems with use of the current Flash 11.3 versions. Some Firefox users are needing to uninstall tht and downgrade to Flash Player 10.3 (older but secure) or Flash Player 11.2
This problem has had developer attention for a few weeks but there is no sign of a proper solution yet. Note at least some of the problems relate to a new security feature ''protected mode'' used by FlashPlayer on windows systems above Windows XP.
As a Windows user you may wir=sh to check if FlashPlayer works ok on Internet Explorer ? It should do. (But you may have problems if you follow the official advice to use an Adobe uninstaller, you may need to review the IE installation of FlashPlayer afterwards.)
Note the fact that your problem relates to FlashPlayer 11.3 is at the moment no more than a guess, based on the number of known issues at present (and the sytsem information aside that indicates you are using flash 11.3).
The current standard official advice is :
Recent crashes of certain multimedia contents (this includes Youtube videos, certain flash games and other applications) in conjunction with Firefox 13 are most probably caused by a recent Flash 11.3 update and/or a malfunctioning Real Player browser plugin.
In order to remedy the problem, please perform the steps mentioned in these Knowledge Base articles:
[[Flash Plugin - Keep it up to date and troubleshoot problems]]
[[Flash 11.3 crashes]]
[[Flash 11.3 doesn't load video in Firefox]]
Other, more technical information about these issues can be found under these Links:
http://forums.adobe.com/thread/1018071?tstart=0
http://blogs.adobe.com/asset/2012/06/inside-flash-player-protected-mode-for-firefox.html
-------------------------- -
Home sharing not working? does not register even when it is turned on
Hi, We watched a movie last week and all was fine. Tonight Apple TV wouldn't recognize home sharing turned on on my mac. Any advice would be greatly appreciated
I've had this happen on occasion. Usually restarting the Apple TV, by pulling the power plug and then plugging it back in again, solves the problem. That is of course, if no other changes have taken place on your network or Mac between now and the last time it worked. Let us know how it goes.
-
ORA-04043: object SYS.DELTA$SESSION does not exist
Dear Friends
after I import my data by using the follwoing import script :
IMP JCC/P_MANUF FILE =JCC.DMP FULL
and at the end give this message import has been imported succesfully without warning
then when I use this script :
SQL> SELECT TNAME FROM TAB
2 WHERE TNAME LIKE 'USER_SESSION'
3 /
TNAME
USER_SESSION
The table USER_SESSION is exist but when I try to desplay the structure of the USER_SESSION by using this :
SQL> DESC USER_SESSION
ERROR:
ORA-04043: object SYS.DELTA$SESSION does not exist
and when I try to use the select statment as the following
SELECT * FROM USER_SESSION
ERROR at line 1:
ORA-00980: synonym translation is no longer valid
Waiting for your valuable answer.
Best regards
Jamil AlshaibaniSQL> select * from V$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for Linux: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> !uname -a
Linux KAD-VMWARE 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
SQL> sho user
USER is "SYS"
SQL> select object_type,status from dba_objects where object_name = 'K_DRWDWN_GRP' and OWNER = 'SYS';
no rows selected
Is any thing wrong with my dictionary? please let me know if i missed anything?
Edited by: sanora600 on Oct 16, 2010 12:34 AM
Maybe you are looking for
-
How fast should I be able to download?
I have had BT infinity for 2-3 months now, and I never seem to get a download speed of more than 4 megs a second It can start at 6 every once in a while, last about 10 seconds and then quickly run down to 3-4 megs and sit there until the d/l is finis
-
BT selling a service that they know they can't pro...
I had no replies to my previous message about our intermittent broadband - or lack of it. At present we have had no broadband since Sunday (currently using Vodafone GPRS - our only alternative). Our connection is fine until the phone rings, then it d
-
Trouble shoot opening attachments in gmail
cannot open documents which come as attachments in gmail
-
Issue after downloading excel file: SYLK format
Hi experts, I have downloaded an excel file through 'GUI_DOWNLOAD'. When I open the file, I get a pop up message which says: "Excel has detected that mg.xls is a SYLK file, but cannot load it. Either the file has error, or it is not a SYLK file forma
-
I just put a new battery in my Iphone 3Gs
I just put a new battery in my Iphone 3Gs and I plugged it in two charge and it says it's charging but it has not started yet. It has been like 45 minutes. Did I do anything wrong? Thanks.