what i understand from this code is as follows:
i add an object to the session scope of page context. the
jsp engine creates a unique id and stores the object and id on server in a hashtable or smtn. it also stores a cookie containing this id, on the client IE.
the problem is that when i disabled all cookies in my IE , this code still works. but i havent used any encodeURL here, then why does it work?
--------------------------------------------
<%@page contentType="text/html" %>
<%!
/* functions come here */
%>
<%
/* code comes here */
StringBuffer htmlBuffer = new StringBuffer();
Integer i1 = new Integer(10);
pageContext.setAttribute("integer",i1,PageContext.SESSION_SCOPE);
Integer i2 = (Integer)pageContext.getAttribute("integer",PageContext.SESSION_SCOPE);
htmlBuffer.append(i2.toString());
%>
<html>
<body>
<%= htmlBuffer.toString() %>
<h1>Hello World JSP</h1>
<a href="test2.jsp">next page</a>
</body>
</html>
--------------------------------------
<%@page contentType="text/html" %>
<%!
/* functions come here */
%>
<%
/* code comes here */
StringBuffer htmlBuffer = new StringBuffer();
Integer i1 = (Integer)pageContext.getAttribute("integer",PageContext.SESSION_SCOPE);
if(i1 == null)
{
htmlBuffer.append("session does not exist.");
}
else
{
htmlBuffer.append(i1.toString()+" is the value.");
}
%>
<html>
<body>
<h3><%= htmlBuffer.toString() %></h3>
</body>
</html>
------------------------------------------