<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java Interview Questions &#187; Cookies Interview Questions</title>
	<atom:link href="http://www.bestjavainterviewquestions.com/category/cookies-interview-questions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bestjavainterviewquestions.com</link>
	<description>Java Interview Questions &#124; Core Java Interview Questions &#124; Advanced Java Interview Questions &#124; EJB Interview Questions &#124; J2EE Interview Questions &#124; Hibernate Interview Questions</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cookie Examples</title>
		<link>http://www.bestjavainterviewquestions.com/cookie-examples-2/</link>
		<comments>http://www.bestjavainterviewquestions.com/cookie-examples-2/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 17:23:19 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Cookie Example]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=286</guid>
		<description><![CDATA[2. Cookies It is sometimes necessary to use cookies for storing information on the client side. A cookie can be accessed from within an element, if the element definition contains an incookie or outcookie tag. An incookie is a cookie that can be read, and an outcookie can obviously be set. Let&#8217;s show how it [...]]]></description>
			<content:encoded><![CDATA[<p>2. Cookies</p>
<p>It is sometimes necessary to use cookies for storing information on the client side. A cookie can be accessed from within an element, if the element definition contains an incookie or outcookie tag. An incookie is a cookie that can be read, and an outcookie can obviously be set.</p>
<p>Let&#8217;s show how it works with a small example where we store the time when the user last visited a certain page. This is a typical real world example, and could be used for example to determine which news items are new since the last visit on a news site.</p>
<p>If we call our cookie last_visit and want to let the element NewsList get and set the cookie, the element definition would look like this:</p>
<p>Example 9.4. Defining an element with a cookie</p>
<p>&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;!DOCTYPE element SYSTEM &#8220;/dtd/element.dtd&#8221;&gt;</p>
<p>&lt;element implementation=&#8221;NewsList&#8221;&gt;<br />
&lt;incookie name=&#8221;last_visit&#8221;/&gt;</p>
<p>&lt;outcookie name=&#8221;last_visit&#8221;/&gt;<br />
&lt;/element&gt;</p>
<p>Now that the element is allowed to access the cookie, we can write the Java code to read and write the cookie.</p>
<p>Example 9.5. NewsList.java: Using cookies from Java</p>
<p>package org.rifers.elephant.elements;</p>
<p>import com.uwyn.rife.engine.Element;</p>
<p>import javax.servlet.http.Cookie;<br />
import java.util.*;<br />
import java.text.*;</p>
<p>public class NewsList extends Element<br />
{<br />
public void showNews(Date lastVisited)<br />
{<br />
// Print new news items<br />
}</p>
<p>public void processElement()<br />
{<br />
Date date = Calendar.getInstance().getTime();</p>
<p>if (hasCookie(&#8220;last_visit&#8221;))<br />
{<br />
Cookie cookie = getCookie(&#8220;last_visit&#8221;);</p>
<p>try<br />
{<br />
Date last = DateFormat.getInstance().parse(cookie.getValue());<br />
showNews(last);<br />
}<br />
catch (ParseException e)<br />
{<br />
// Handle exception<br />
}<br />
}<br />
else<br />
{<br />
showNews(null);<br />
}</p>
<p>setCookie(new Cookie(&#8220;last_visit&#8221;,<br />
DateFormat.getInstance().format(date)));<br />
}<br />
}</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>November 8, 2008 -- <a href="http://www.bestjavainterviewquestions.com/which-of-the-collection-classes-will-not-allow-duplicate-values/" title="Which of the Collection Classes will not allow duplicate values">Which of the Collection Classes will not allow duplicate values</a> (1)</li><li>September 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/what-is-default-package-in-java/" title="What is Default Package in Java">What is Default Package in Java</a> (0)</li><li>September 20, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-sessionsave-and-sessionsaveorupdate-3/" title="Difference between session.save() and session.saveOrUpdate()">Difference between session.save() and session.saveOrUpdate()</a> (0)</li><li>October 16, 2008 -- <a href="http://www.bestjavainterviewquestions.com/how-to-run-a-java-web-application/" title="How to run a Java web application">How to run a Java web application</a> (0)</li><li>August 24, 2008 -- <a href="http://www.bestjavainterviewquestions.com/software-architecture-of-ejb/" title="Software  Architecture of EJB">Software  Architecture of EJB</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/cookie-examples-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define Cookie Poisoning</title>
		<link>http://www.bestjavainterviewquestions.com/define-cookie-poisoning/</link>
		<comments>http://www.bestjavainterviewquestions.com/define-cookie-poisoning/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 11:36:53 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Cookies Interview Questions]]></category>
		<category><![CDATA[cookie poisoning]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=279</guid>
		<description><![CDATA[Q) What is cookie poisoning: A) The modification of or theft of a cookie in a user&#8217;s machine by an attacker in order to release personal information. If the cookie contains username and password, thieves can use their own computers and confiscated cookies to enter victims&#8217; accounts. See cookie. Random PostsMay 22, 2008 -- Core [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q) What is cookie poisoning:<br />
A) </strong>The modification of or theft of a cookie in a user&#8217;s machine by an attacker in order to release personal information. If the cookie contains username and password, thieves can use their own computers and confiscated cookies to enter victims&#8217; accounts. See <span style="font-size: small; color: green;"><em><a class="wp-caption" title="what to know about cookie" href="http://computerpreferedcourses.blogspot.com/" target="_blank">cookie</a>.</em></span></p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>June 23, 2008 -- <a href="http://www.bestjavainterviewquestions.com/19/" title="Java Basic Questions">Java Basic Questions</a> (1)</li><li>September 20, 2008 -- <a href="http://www.bestjavainterviewquestions.com/cookie-examples-2/" title="Cookie Examples">Cookie Examples</a> (0)</li><li>September 2, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-session/" title="Define Session">Define Session</a> (0)</li><li>September 17, 2008 -- <a href="http://www.bestjavainterviewquestions.com/hibernate-introduction/" title="Hibernate Introduction">Hibernate Introduction</a> (0)</li><li>October 4, 2008 -- <a href="http://www.bestjavainterviewquestions.com/explain-executeupdate-method/" title="Explain executeUpdate Method">Explain executeUpdate Method</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/define-cookie-poisoning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Define Cookies</title>
		<link>http://www.bestjavainterviewquestions.com/define-cookies/</link>
		<comments>http://www.bestjavainterviewquestions.com/define-cookies/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 11:09:10 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[Cookies Interview Questions]]></category>
		<category><![CDATA[cookies]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=275</guid>
		<description><![CDATA[Q) What is Cookies A) Cookies Definition:                                                                                                 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q) What is Cookies</strong></p>
<p><strong>A) </strong><em>Cookies Definition</em>:                                                                                                                                       The <a class="wp-caption" title="know more about cookies click this" href="http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/http/Cookie.html" target="_blank">cookie</a> file is a file that resides on the client machine. It contains data passed from web sites, so that web sites can communicate with this file when the same client returns. The web site only has access to the part of the cookie file that represents the interaction with that particular web site. Clearly the cookie file has caused some issues with respect to privacy. Considering that as consumers, we do not know what information is being stored in the file, we should become concerned! The cookie file was first developed in order to help sites with the transaction process of the web. Without a cookie file, web sites are not able to track a single user&#8217;s path through a web site, thus a transaction that required multiple pages (as most do) would simply not be workable.</p>
<p><strong>Some Examples of Cookies Click here</strong>:<span style="font-size: small; color: blue;"> <a class="wp-caption" title="examples  of cookies" href="http://www.bestjavainterviewquestions.com/cookie-examples/" target="_blank">CookieExamples</a></span></p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>August 15, 2008 -- <a href="http://www.bestjavainterviewquestions.com/what-is-thread-how-to-use-threads/" title="What is Thread, How to Use Threads?">What is Thread, How to Use Threads?</a> (0)</li><li>October 5, 2008 -- <a href="http://www.bestjavainterviewquestions.com/what-is-unicode-system/" title="What is unicode System">What is unicode System</a> (0)</li><li>August 15, 2008 -- <a href="http://www.bestjavainterviewquestions.com/thread-example-for-runnable-interface/" title="Thread example for Runnable Interface">Thread example for Runnable Interface</a> (1)</li><li>September 30, 2008 -- <a href="http://www.bestjavainterviewquestions.com/explain-thread-safe-jsp-page-and-there-advantages/" title="Explain Thread-Safe JSP page and there advantages">Explain Thread-Safe JSP page and there advantages</a> (0)</li><li>November 6, 2008 -- <a href="http://www.bestjavainterviewquestions.com/marking-or-tagging-interface/" title="Marking or Tagging Interface">Marking or Tagging Interface</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/define-cookies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

