Setting the cookies
Hi
I trying to add the cookie into local machines.Problems is i written cookie program on cookietest.jsp then i incude this jsp into index.jsp.When accessing the index.jsp the cookies are not setting But when iam acessing cookietest.jsp cookies are adding.why index.jsp accessing time not adding??please help me how to achive this one.
below the code snippet
**********************cookietest.jsp***********************
<%@ page import="java.util.Date"%>
<%@ page import="java.net.*"%>
<%
Date now = new Date();
String timestamp = now.toString();
Cookie cookie = new Cookie ("Venkateswarlu", "ravi");
cookie.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(cookie);
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>
**************************end*****************************
***********************index.jsp***************************
<jsp:include page="/cookietest.jsp"/>
Thanks for advace
Venkatesearlu Ravi
<jsp:include page="/cookietest.jsp"/>Since you are using <jsp:include> it is only going to include the response from the cookietest.jsp. The cookie setting part gets lost in between the page include. Use the include directive instead.
<%@ include file="relativeURL" %>The include directive includes the code at jsp compile time and the cookie setting code will get processed when it really should.
Similar Messages
-
hi,
when i do, submiting the page i'm able to set the cookie value.I'm not getting any messages. But the Same time when i call the proceudre with parameters from the URL i'm not able to store the cookie value.
It display's the message like this and the value is not stored in the cookies
Content-type: text/html Set-Cookie: emp_no=9999X; path=/;
my code is :
owa_util.mime_header('text/html',FALSE);
owa_cookie.send('emp_no',UPPER(lv_emp_no),null,'/',null,null);
owa_util.http_header_close;
How do i solve this problem?
ThanksHi,
Here are a couple of things you can try:
1) remove the following line because it shouldn't be necessary:
the_cookie.num_vals :=0;2) remove the following line because the owa_cookie.send will automatically replace any existing cookie:
owa_cookie.remove('emp_no',the_cookie.vals(1),null);3) try capturing the cookie value in a local variable and printing it (after htp.body, of course) to see if it is working correctly.
4) enable the browser to prompt you when a cookie is being set so that you can verify whether it is being set or not.
HTH,
Ashesh Parekh
Oracle9iAS Product Management
hi,
Something like this...
Code
PROCEDURE checkLogin ( emp_no in varchar2 default NULL) IS
pv_check_f BOOLEAN ;
the_cookie owa_cookie.cookie;
BEGIN
pv_check_f := FUN_EMP_PASSWORD(UPPER(emp_no) ) ;
IF NOT pv_check_f THEN
v_msg := 'Sorry Log on denied';
RAISE EMP_ERROR;
END IF ;
the_cookie.num_vals :=0;
the_cookie:= owa_cookie.get('emp_no');
if the_cookie.num_vals= 0 then
owa_util.mime_header('text/html',FALSE);
owa_cookie.send('emp_no',UPPER(emp_no),null,'/',null,null);
owa_util.http_header_close;
else
owa_util.mime_header('text/html',FALSE);
owa_cookie.remove('emp_no',the_cookie.vals(1),null);
owa_cookie.send('emp_no',UPPER(emp_no),null,'/',null,null);
owa_util.http_header_close;
end if;
htp.p('<script language="javascript">
window.location="http://www...URL";
</script>');
htp.formclose;
EXCEPTION
WHEN EMP_ERROR THEN
Pageheader;
Procedurename.Banner('Login denied');
htp.fontOpen('red','Arial Narrow');
htp.header(3,lv_msg);
loginagain;
htp.fontClose;
htp.centeropen;
htp.br;
htp.p('<INPUT type="button" value="Back" onClick="history.back()">');
htp.br;
htp.centerclose;
pagefooter;
END checkLogin;
calling the Procedure "checklogin" with the parameter emp_no from the URL like this
"http://....:8810/dir/Packname.checkLogin?emp_no=9ABCDS".
Waiting for ur replay.
Thanks. -
How to set the cookie or session of one domain to another domain
Hi,
I am using tomcat server. I am facing a issue of session lost when I am moving from one domain to another domain.
e.g. http://mydomain.com/ to http://a.mydomain.com.
Is there any way to set the cookie or same session to sub domain in tomcat.
Please help me. I will be highly obliged.a tutorial from JavaWorld
http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-servlets.html?page=1 -
Hi
Iam trying to add the cookie into local machine.Problems is i written cookie program in cookietest.jsp then i incude this jsp into index.jsp.When iam accessing the index.jsp cookies are not setting But when iam acessing cookietest.jsp cookies are adding.why index.jsp accessing time not adding??please help me how to achive this one.
below the code snippet
**********************cookietest.jsp***********************
<%@ page import="java.util.Date"%>
<%@ page import="java.net.*"%>
<%
Date now = new Date();
String timestamp = now.toString();
Cookie cookie = new Cookie ("Venkateswarlu", "ravi");
cookie.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(cookie);
%>
<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>
**************************end*****************************
***********************index.jsp***************************
<jsp:include page="/cookietest.jsp"/>
Thanks for advace
Venkatesearlu RaviActually this is requirment
I have to add the that cookie code snippet to every
page.SO what i did is i placed the cookie code
snippet into footer.jsp.This footer jsp will include
every page..Here cookie is not adding.
Is there any solution.I also tried this with JSTL c:import, since the JSTL1.1 spec says that c:import covers many of the shortcomings of jsp:include.
/p/cookies/include.jsp
<%@ page import="java.util.Date"%>
<%@ page import="java.net.*"%>
<%
Date now = new Date();
String timestamp = now.toString();
Cookie cookie = new Cookie ("Venkateswarlu", "ravi");
cookie.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(cookie);
%>
/p/cookies/page1.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:import url="/p/cookies/include.jsp"/>
<html>
<head><title>Page 1</title></head>
<body>
<%request.getCookies();%>
</body>
</html>
/p/cookies/page2.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:import url="/p/cookies/include.jsp"/>
<html>
<head><title>Page 2</title></head>
<body>
<%request.getCookies();%>
</body>
</html>
But the result is the same as jsp:include as far as setting HTTP Headers (Cookies) is concerned.
So the conclusion is that you can't really set HTTP headers in include files.
Then, you can try it with Servlets instead of JSPs. But then, you'll need to call the servlet each time, before every JSP is invoked.
I don' know how that's done. Probably through Filters
(a wild guess)
Message was edited by:
appy77 -
How to set the domain of a cookie in localhost environment
in some scenario i have to set the domain of cookie on my local environment,
how can be done?????????????
i.e http://localhost:7001/myapp/testservlet
how to set the cookie domain for "myapp"Hi
After Some googling I could find out this for you. I think it is a bug with IE.
http://www.webmasterworld.com/forum21/11530.htm
The idea is to use a virutal host.
HTH
VJ -
How can we access the cookie set by cfheader in the same request?
I've set a cookie in my application.cfm using cfheader and in the same request i need to access the cookie. How can i do this?
Unless you know the values you're setting in the cookie explicitly then I don't know if you can - not sure if it's one of those things whereby a cookie doesn't exist until it's hit their browser, and if you page hasn't finished rendering then it hasn't hit their browser.
I'd suspect you'll try it and either it'll work or it won't.
If you're setting the cookie explicitly with you own UUID's or similar you will of course know what you'll be setting it to.
If that made any sense.
Which I'm pretty sure it didn't.
O. -
Can we change the name of the cookie - JSESSIONID?
Can we change the name of the cookie- JSESSIONID?
for eg.
Set-Cookie = [ JSESSIONID=6ad8360e0d1af303293f26d98e2a; Version=1; Comment=Sun+ONE+Application+Server+Session+Tracking+Cookie; Path=/]
can we change it to something like -
Set-Cookie = [ ServletSession=RkA4OlbgfW; path=/]Thankyou Sultal for the response.
Actually we are migrating the application server from Weblogic5.1 to Sun application server 8.2. The client is a mobile client and it sends the Cookie as 'JSESSIONID=session_id_val&WeblogicSession=session_id_val' as parameters, not as request header.It worked fine for Weblogic5.1 but not in Sun Application Server.
To make it clear :
Weblogic : request.getsession(false) = sessionObj@value
Sun Application Server : request.getsession(false) = null
Sun Application Server : request.getParameter("JSESSIONID") = session_id_val
In the Weblogic5.1 we have set the cookie & session parameters in the weblogic.properties file as:
weblogic.httpd.session.cookies.enable=true
weblogic.httpd.session.cookie.name=WebLogicSession
weblogic.httpd.session.neverReadPostData=false
weblogic.httpd.session.timeoutSecs=120
In case of Sun application server , JSESSIONID is not coming as a cookie , request.getsession(false) is returning null value.Is there a way to initialize the session with JSESSIONID request parameter? -
Firefox wrecked the cookie functions in Safari
I'm reporting a bug that started after setting the cookies option in Firefox to "block all". There was no real reason to do this I was just testing the new toolbar gizmo I'd gotten from somewhere. I turned it back on but then...
Now neither Safari or Firefox can access my Amazon.com cart or perform cookie based security at my email provider.
I've tried deleting the plist files for both and rebooting and ...
Any ideas?
Regards,
DaveThere was no real reason to do this
Then why did you do it?
I was just testing the new toolbar gizmo I'd gotten from somewhere.
What is the exact name of this "toolbar gizmo" and what is it supposed to do?
Now neither Safari or Firefox can access my Amazon.com cart or perform cookie based security at my email provider.
That's not any indication of a bug.
I've tried deleting the plist files for both and rebooting and ...
Doing that was a waste of time, since it would have no effect on any cookies.
We need a lot more details if you want help for this problem. But until there is firm, reproducible evidence of a bug in Safari or Firefox, you should stop making that assumption.
Mulder -
I read the follow article.
http://www.mozilla.org/projects/security/pki/psm/help_21/using_priv_help.html
In this article under "Managing Cookies Site-By-Site" It said
"To control cookies on a site-by-site basis:
1. Open the Tasks menu, choose Privacy & Security, and then choose Cookie Manager.
2. Choose "Unblock Cookies from this Site" or "Block Cookies from this Site."
When you are warned (while browsing) that a web site is requesting to set a cookie, you can click Yes to allow or No to deny the cookie. You can also select the option for your browser to "Remember this decision."....
My questions is 1. I can't find the cookie Manager in firefox (I have the latest version). The article said "Open task menu, choose Privacy&Security... is that they same as under menu bar, tools, options, privacy (but under this option I don't see the cookie manager mention in the article. (I am thinking what they are describing is not for the version of firefox I have?).
Bottom lines, I want to set Firefox so It will ask me each time the website want to install a cookie and for me to decide to allow that or not. I article above seem to describe how to do that but either I am looking in the wrong place or I am not doing it right.
thanks in advance.
panzer_aceHi,
I think that what you are searching be in Tools >> Options >> Privacy >> On Firefox will: change to "Use custom settings for history" then Button Show Cookies will be allowed and you will see the cookies in your browser in the next window
If you uncheck "Accept cookies from sites", probably the sites that need cookies will alert you that you need active the storage cookies -
In safari browser cookies is working fine. But when I add the browser url to the screen then the cookies concept is not working. In safari setting cookies is always open only. Can you please provide any information regarding to this?
Hello,
'''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
''(If you're using an added theme, switch to the Default theme.)''
If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
[[Image:FirefoxSafeMode|width=520]]<br><br>
If Firefox is not running, you can start Firefox in Safe Mode as follows:
* On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
* On Mac: Hold the '''option''' key while starting Firefox.
* On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
''Once you get the pop-up, just select "'Start in Safe Mode"''
[[Image:Safe Mode Fx 15 - Win]]
'''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
When you figure out what's causing your issues, please let us know. It might help others with the same problem.
Thank you. -
Since I did the Firefox reset, I try to open my email and it says, Your browser does not accept cookies. I have checked and done your suggested setting 100 times!
Note that a reset tries to migrate cookies to the new profile, so if you had previously as problem with cookies then the problem might have been carried over.
If clearing cookies doesn't work then it is possible that the <i>cookies.sqlite</i> file that stores the cookies is corrupted.
Rename (or delete) <b>cookies.sqlite</b> (cookies.sqlite.old) and delete other present cookie files like <b>cookies.sqlite-journal</b> in the Firefox profile folder in case the file cookies.sqlite got corrupted.
*http://kb.mozillazine.org/Cookies
*https://support.mozilla.org/kb/Deleting+cookies -
How to set a cookie in the browser from an html page called via an Iview
How to set a cookie in the browser from an html page called via an Iview
Hello all,
I have an issue which is causing problems. I have a snap survey (html form with submit and cookie setting) which is embedded in a url iview.
Although the submit and the form work fine, the portal will not allow the cookie to be set it seems.
Is there a way to allow cookies to be set from an embedded page in a url iview??
You will make my day if you know!
System: EP7 SP13
Kind regards
AlexHi,
Check this:
http://www.oracle.com/technology/products/ias/portal/html/same_cookie_domain_with_pdkv2.html
Cookie Basics
Web browsers have built in rules for receiving and sending cookies. When a browser makes a request to a web server and the web server returns cookies with the response, the browser will only accept a cookie if the domain associated with the cookie matches that of the original request. Similarly, when a browser makes a subsequent request, it will only send those cookies whose domain matches that of the target web server.
These rules are designed to ensure that information encoded in cookies is only "seen" by the web server(s) that the originator of the cookie intended. These rules also ensure that the cookie cannot be corrupted or imitated by another server. By default, the domain associated with a cookie exactly matches that of the server that created it. However, it is possible to modify the domain at the time the cookie is created. Relaxing the cookie domain increases the scope of the cookie's visibility making it available to a wider "audience" of web servers.
For example, if a cookie is created by a.us.oracle.com, it's domain will usually be set to a.us.oracle.com. This means that the browser will only send the cookie to a.us.oracle.com. It will never send it to any other servers. However, if at the time of creation, the domain of the cookie is set to .us.oracle.com, the browser will send the cookie to any server whose domain falls within .us.oracle.com. such as portal.us.oracle.com, provider.us.oracle.com, app.us.oracle.com etc
Regards,
Praveen Gudapati -
Where can i set the location of the LogonTicket cookies in the visual admin
hello:
where can i set the location of the LogonTicket cookies in the visual administrator?
thanks!!Hi,
When the SAP LOGON ticket Expired or if we need to update the dates, it is generally done at the Visual Administration Level. SAP Logon Ticket is represented as cookie in the Browser which will help us for SSO.
In Visual Admin under keystore admin where our Old Portal certificate exists.
We will need to delete the old portal certificate, then we need to generate new ceritificate and a pop box will appear.. where we need to provide our System details like SID, Client. After these details are given we can get a new certificate in which validity period dates are automatically generated. And also we can import teh same into Portal at Sys Admin->sys config->key store admin for it to be available as .PSE or .DER file for SSO.
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/59bba290-0201-0010-468b-cd12efda573a
check the above for EP security guide which might help you in the same.
Regards,
Ravi -
On my mini ipad, when I'm on the internet -- a few times I will see a blue small pop-up boxes telling me to allow down/load or add something like the bubble-splash game or something similar. I jusr click ignore and it goes away.. I'm not sure why it's showing up lately.. I'm not sure if it's a virus or hacked in or a web brower matter..
Should I go to the cookies/histories in the safari setting and have it cleared out? Will that help resolve that??
And what does the advance-setting of the clearing the website data does? Sorry, I'm not familiar.. what's is that used for? Should I use that feature as well?? Thank you!This indicates corrupt files.
A restore should resolve. -
FF Privacy and FF Sync : FF Sync keeps asking me to 'set up...' becuase [ i think] I have Privacy Mode on and therefore all the cookies are deleted. Is this correct ? Can FF Privacy 'understand' that Sync should be allowed ?
== This happened ==
Every time Firefox opened
== From Load of FF Sync''guigs2 [[#answer-672422|said]]''
<blockquote>
NoScript stops cookies, please disable this addon/extension as well as make sure that the language en-us is installed.
# 1) Open up the Firefox Preferences tab. You can do this by typing about:preferences in the URL bar.
# 2) Click "Content"
# 3) Next to "Languages", click "Choose"
# 4) Select "English/United States [en-us]", click "Add"
# 5) re-open "about:accounts"
# 6) Click "Get Started"
</blockquote>
Thank you for replying. Unfortunately, I already did all of these things. As you can see from the below screenshot, the language is already set. Also, this screenshot was taken in Safe Mode, so NoScript is not enabled. About:accounts still says I need to enable cookies for some reason. So, this solution didn't work....
Maybe you are looking for
-
My music editing program Finale can open files from the 90:s. Pages 5 can't open files I made half a year ago in Pages 08. Some difference in knowledge there. 5 years work is gone, if Apple are inable to fix this. Perheps they are?
-
My phone number is 00000000000, receiving no tap to pay link neither
HI all, Dropped my S5 down the toilet, so bought a S6 edge to replace it. Did that, got a new sim (needed NFC and nano sized), but my number is showing up as 0000000000 in the status screen. I think this may be related to why i am not getting any lin
-
How do I map a drive for file adapter
I am using a File adapter in XI, and would like to read files from a different server. In the file adapter, there is no place for a username/password, so I need to map a drive first, then use the drive letter in the file adapter. eg Source Directory
-
I'm using java.util.Logging mechanism for logging in my web application. I always use logger via class name - e.g. Logger.getLogger(MyClass.class.getName()).log(....)Now, I wonder if there is a technique or best practice to show only log records for
-
MWB (tool mdb -- Oracle 8i)
A number of the industry standard PC-Based tools have mdb (Access) backends. (In our case, Database and Application Security Scanning Tools.) We would convert the results from these tools to Oracle 8i for enterprise-wide web-based access and reportin