• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

where does PageContext store the info?

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
------------------------------------------
 
Neeraj Macker
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
someone plz answer!!!
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two types of cookies. MSIE has a separate switch for session cookies.
It's in the 'Advanced Privacy' section.
 
Neeraj Macker
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ur response was so curt, i cudnt make anyting out of it!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you disabled cookies but not "session cookies" then JSP sessions will continue to work without URL re-writing.

Look at -> tools -> internet options -> privacy (tab) -> advanced (button).
There is a checkbox labled "always allow session cookies".

Check that.
 
reply
    Bookmark Topic Watch Topic
  • New Topic