cookie

cookie

View Answers

November 5, 2008 at 2:28 PM

hi, sowmya
try the following code.

there is two html
1- cookieParent.html
2 - cookieChild.html

open the cookieParent.html and enter the value in the text box and pres the button in next pageyou will get the value which is you entered in the cookieParent.html page.

cookieParent.html-
<html>

<head>
<Script language="JavaScript" version="1.2">

cookie_name = "dataCookie";
var YouEntered;

function putCookie()
{

if(document.cookie != document.cookie)
{
index = document.cookie.indexOf(cookie_name);
}
else
{
index = -1;
}
if (index == -1)
{
YouEntered=document.cf.cfd.value;
document.cookie=cookie_name+"="+YouEntered+"; expires=Friday, 29-Jan-2008 05:10:00 IST";
}

}


function submitForm(){
location.href = "cookieChild.html" ;

}



</Script>

</head>

<body>

<form name="cf">

<table>
<tr>
<td>Enter A Word:</td>
<td><input type="text" name="cfd" size="20"></td>
</tr>
<tr>
<td></td>
<td><input type="button" Value="Set to Cookie" onClick="putCookie();submitForm();"></td>
</tr>
</table>
</form>
</body>
</html>



cookieChild.html -
<SCRIPT LANGUAGE="JavaScript">

cookie_name = "dataCookie";
var YouWrote;

function getName() {
if(document.cookie)
{
index = document.cookie.indexOf(cookie_name);
if (index != -1)
{
namestart = (document.cookie.indexOf("=", index) + 1);
nameend = document.cookie.indexOf(";", index);
if (nameend == -1) {nameend = document.cookie.length;}
YouWrote = document.cookie.substring(namestart, nameend);
return YouWrote;
}
}
}

YouWrote=getName();
if (YouWrote == "dataCookie")
{YouWrote = "Nothing_Entered"}


</SCRIPT>


<SCRIPT LANGUAGE="javascript">
document.write("You Entered " +YouWrote+ ".");
</SCRIPT>

<SCRIPT LANGUAGE="javascript">
document.write("<FORM>")
document.write("You Entered:")
document.write("<INPUT TYPE=text SIZE=30 VALUE=" +YouWrote+ ">");
document.write("</FORM>")
</SCRIPT>

November 7, 2008 at 3:02 PM

Visit for more information.


http://www.roseindia.net/jsp/jspcookies.shtml


Thanks









Related Tutorials/Questions & Answers:
Cookie in jsp
Cookie in jsp  Define Cookie in jsp ?   The cookie file is a file that resides on the client machine. It contains data passed from web... returns. The web site only has access to the part of the cookie file that represents
Persistent Cookie
Persistent Cookie  What Is a Persistent Cookie?   Hi friends, A persistent cookie is a cookie which is stored in a cookie file permanently... because users can open cookie files see the cookie values. Thanks
Advertisements
set cookie in jsp
set cookie in jsp  How set cookie in jsp ?   Cookie... cookie to identify the user in the next time visit.Example : <% Cookie cookie = new Cookie("ClientName","Roseindia"); cookie.setMaxAge(3600
How to reset a cookie?
How to reset a cookie?  How to reset a cookie
How to destroy a cookie?
How to destroy a cookie?  How to destroy a cookie
What Is a Persistent Cookie?
What Is a Persistent Cookie?  What Is a Persistent Cookie?. Explain
Setting Cookie
Setting Cookie  setcookie function is used for setting up a cookie. In the following example, if you use $_COOKIE command, you will view one cookie value, and if you see print_r ($_COOKIE), you will view all cookie value. We have
Cookie methods in jsp
Cookie methods in jsp   Define cookie methods in jsp ?    Cookie methods : clone() getComment() getDomain() getMaxAge() getName() getPath() getSecure() getValue() getSecure() getVersion
Cookie Handling - JSP-Servlet
Cookie Handling  Hi i am working on the Application in which i... on a per user setting (probably via a cookie). This would of course mean that when..."; //get the array of cookies. Cookie cookies [] = request.getCookies
Write cookie and session to textfile?
Write cookie and session to textfile?  I want to store all data from user submisstion into a textfile, include session and cookie. Thanks
Removing existing cookie in jsp
Removing existing cookie in jsp  How remove existing cookie in jsp ?   If you want to remove an existing cookie, you can use the method setMaxAge() of that cookie object to set its timeout to zero.Example <%@page
Delete Cookie
the cookie through setting session.  In the given example, we have set the value of cookie after one month of generating and before one hour of system date. ADS_TO_REPLACE_1 For deleteing the cookies, you will have to set the cookie
problem with cookie - Struts
problem with cookie  struts cookies response - Hii, I am a beginner in struts..Well, I try to add username and group(or whatever) to a cookie but not able to access the cookie value in the next page after submitting the form
Is session depend on cookie ???
Is session depend on cookie ???  Since I created one session & as we say that session store at server side that means if I clear browser cookie... the cookie then my user logged out that means there is something behind session
cookie and session dependency
cookie and session dependency  Hi, I am currently working on a project in travel domain. Throughout the application, we have not used cookie for session tracking but the case when browser cookie is disabled, session value differs
Clear cookie example
Clear Cookie Example    .... The example below shows how to delete the cookie from the browser using JavaScript. The code below has saveCookie() method that is used to create the cookie
How can we destroy the cookie?
How can we destroy the cookie?   How can we destroy the cookie
Differences between session and cookie
Differences between session and cookie  What are the differences between session and cookie?   Session is stored in server but cookie.... But it is limited in cookie. Session can store objects and cookies can store only
cookie - Java Beginners
cookie  i want to display cookie name and value on web page how? ...- cookie_name = "dataCookie"; var YouEntered; function putCookie... = document.cookie.indexOf(cookie_name); } else { index = -1
Version of ai.cookie>cookie-datasets_2.10 dependency
List of Version of ai.cookie>cookie-datasets_2.10 dependency
javascript cookie - Java Beginners
attribute of cookie in javascript. heres the code : document.cookie = 'cookie2=Second_cookie'; expires=Mon, 17-Aug-09 04:42:00 GMT; path="/"'; whats wrong... to set the cookie and expire the cookie: function getCookie(cookieName
ModuleNotFoundError: No module named 'cookie-eater'
ModuleNotFoundError: No module named 'cookie-eater'  Hi, My Python... 'cookie-eater' How to remove the ModuleNotFoundError: No module named 'cookie-eater' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'crypto-cookie'
ModuleNotFoundError: No module named 'crypto-cookie'  Hi, My... 'crypto-cookie' How to remove the ModuleNotFoundError: No module named 'crypto-cookie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'js.jquery_cookie'
ModuleNotFoundError: No module named 'js.jquery_cookie'  Hi, My... named 'js.jquery_cookie' How to remove the ModuleNotFoundError: No module named 'js.jquery_cookie' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'js.jquery_cookie'
ModuleNotFoundError: No module named 'js.jquery_cookie'  Hi, My... named 'js.jquery_cookie' How to remove the ModuleNotFoundError: No module named 'js.jquery_cookie' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'oauth2-proxy-cookie'
ModuleNotFoundError: No module named 'oauth2-proxy-cookie'  Hi, My... named 'oauth2-proxy-cookie' How to remove the ModuleNotFoundError: No module named 'oauth2-proxy-cookie' error? Thanks   Hi
ModuleNotFoundError: No module named 'secure-cookie'
ModuleNotFoundError: No module named 'secure-cookie'  Hi, My... 'secure-cookie' How to remove the ModuleNotFoundError: No module named 'secure-cookie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'secure-cookie'
ModuleNotFoundError: No module named 'secure-cookie'  Hi, My... 'secure-cookie' How to remove the ModuleNotFoundError: No module named 'secure-cookie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cookie-eater'
ModuleNotFoundError: No module named 'cookie-eater'  Hi, My Python... 'cookie-eater' How to remove the ModuleNotFoundError: No module named 'cookie-eater' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cookie-manager'
ModuleNotFoundError: No module named 'cookie-manager'  Hi, My... named 'cookie-manager' How to remove the ModuleNotFoundError: No module named 'cookie-manager' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'crypto-cookie'
ModuleNotFoundError: No module named 'crypto-cookie'  Hi, My... 'crypto-cookie' How to remove the ModuleNotFoundError: No module named 'crypto-cookie' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'js.jquery_cookie'
ModuleNotFoundError: No module named 'js.jquery_cookie'  Hi, My... named 'js.jquery_cookie' How to remove the ModuleNotFoundError: No module named 'js.jquery_cookie' error? Thanks   Hi, In your
cookie - JSP-Servlet
. I know it can be done through cookie but i dont knw how canx somebody post
Cookie Tag:
Cookie Tag:       bean:cookie Tag... cookie. This tag retrieve the value of the specified request cookie... attribute), and define  attribute of type Cookie or Cookie[] (depends
Version of com.erikandcolleen>ga-cookie-parser dependency
List of Version of com.erikandcolleen>ga-cookie-parser dependency
Version of com.oakfusion>spring-cookie-session dependency
List of Version of com.oakfusion>spring-cookie-session dependency
setMaxAge Cookie Java
setMaxAge Cookie Java In this tutorial you will learn how to use setMaxAge() of Cookie class in java setMaxAge() method sets the age of the cookie that how long it will be live. In other word we can say when a cookie will be expired
ModuleNotFoundError: No module named 'django-encrypted-cookie-session'
ModuleNotFoundError: No module named 'django-encrypted-cookie-session' ...: ModuleNotFoundError: No module named 'django-encrypted-cookie-session' How to remove the ModuleNotFoundError: No module named 'django-encrypted-cookie-session' error
ModuleNotFoundError: No module named 'django-encrypted-cookie-session-py3'
ModuleNotFoundError: No module named 'django-encrypted-cookie-session-py3' ...: ModuleNotFoundError: No module named 'django-encrypted-cookie-session-py3' How to remove the ModuleNotFoundError: No module named 'django-encrypted-cookie
ModuleNotFoundError: No module named 'odoo10-addon-website-cookie-notice'
ModuleNotFoundError: No module named 'odoo10-addon-website-cookie-notice' ...: ModuleNotFoundError: No module named 'odoo10-addon-website-cookie-notice' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-website-cookie-notice
ModuleNotFoundError: No module named 'odoo11-addon-website-cookie-notice'
ModuleNotFoundError: No module named 'odoo11-addon-website-cookie-notice' ...: ModuleNotFoundError: No module named 'odoo11-addon-website-cookie-notice' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-website-cookie-notice
ModuleNotFoundError: No module named 'odoo12-addon-website-cookie-notice'
ModuleNotFoundError: No module named 'odoo12-addon-website-cookie-notice' ...: ModuleNotFoundError: No module named 'odoo12-addon-website-cookie-notice' How to remove the ModuleNotFoundError: No module named 'odoo12-addon-website-cookie-notice
ModuleNotFoundError: No module named 'odoo9-addon-website-cookie-notice'
ModuleNotFoundError: No module named 'odoo9-addon-website-cookie-notice' ...: ModuleNotFoundError: No module named 'odoo9-addon-website-cookie-notice' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-website-cookie-notice'
ModuleNotFoundError: No module named 'ponddy-cookie-agreement'
ModuleNotFoundError: No module named 'ponddy-cookie-agreement'  Hi...: No module named 'ponddy-cookie-agreement' How to remove the ModuleNotFoundError: No module named 'ponddy-cookie-agreement' error? Thanks   
ModuleNotFoundError: No module named 'apistar_session_cookie'
ModuleNotFoundError: No module named 'apistar_session_cookie'  Hi...: No module named 'apistar_session_cookie' How to remove the ModuleNotFoundError: No module named 'apistar_session_cookie' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cookie-consent'
ModuleNotFoundError: No module named 'django-cookie-consent'  Hi...: No module named 'django-cookie-consent' How to remove the ModuleNotFoundError: No module named 'django-cookie-consent' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cookie-control'
ModuleNotFoundError: No module named 'django-cookie-control'  Hi...: No module named 'django-cookie-control' How to remove the ModuleNotFoundError: No module named 'django-cookie-control' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cookie-law-nl'
ModuleNotFoundError: No module named 'django-cookie-law-nl'  Hi...: No module named 'django-cookie-law-nl' How to remove the ModuleNotFoundError: No module named 'django-cookie-law-nl' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-cookie-message'
ModuleNotFoundError: No module named 'django-cookie-message'  Hi...: No module named 'django-cookie-message' How to remove the ModuleNotFoundError: No module named 'django-cookie-message' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-encrypted-cookie-session'
ModuleNotFoundError: No module named 'django-encrypted-cookie-session' ...: ModuleNotFoundError: No module named 'django-encrypted-cookie-session' How to remove the ModuleNotFoundError: No module named 'django-encrypted-cookie-session' error

Ads