hi
thanks for your answer dear Jeanne.
i've used both of cookie.setPath("/") and cookie.setDomain("localhost") in my code before. but i can't see that cookie in my applicationB :(
I attach my code with this post , I would be thankfull if you check it for me.
Somayeh.
------------------------------------------------------------------
<!--
http://localhost:8080/applicationA/setcookie.jsp -->
<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
Cookie cookie = new Cookie ("cookieName","cookieValue");
cookie.setMaxAge(365 * 24 * 60 * 60);
response.addCookie(cookie);
cookie.setPath("/");
cookie.setDomain("localhost");
%>
<html>
<head>
<title>Cookie Saved</title>
</head>
<h1>Cookie created and saved</h1>
</html>
---------------------------------------
<!--
http://localhost:8080/applicationB/showcookie.jsp -->
<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<title>Show Saved Cookie</title>
</head>
<h1>Show cookies</h1>
<body>
<p>
List of Cookies:<br/>
<c:forEach items="<%=(request.getCookies())%>" var="c">
<b><c:out value="${c.name}" /></b>:
<c:out value="${c.value}" /><br>
</c:forEach>
</body>
</html>