• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting session value in JSP

 
dasari sudha
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
In my application i am calling one JSP from servlet. I set some
attributes in session object in servlet. but getting problem in accessing session object in JSP (getting attribute values as null). does it mean when we specify <%@ page session="true"%> on jsp page, it creates new session
object and so i am getting null values for previously set attributes ?
if i give <%@ page session="false"%>, then i can not get access to
session object.

any help ??

regards,
sudha
 
Eugene Lucash
Ranch Hand
Posts: 77
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
consider not to use such directive at all <%@ page session=""%>
nor true, nor false.
 
Ariel Valentin
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page session="true"%>
Isn't that equivalent to:
HttpSession session = request.getSession(true);
I believe that the directive is implictly set to true but Eugene is correct don't write what you don't have to:
http://java.sun.com/products/jsp/syntax/1.2/syntaxref1210.html

in my application i am calling one JSP from servlet. I set some
attributes in session object in servlet.

How exactly are you doing this? I have run into trouble using http://localhost:someportnumber with session objects in firefox if this is your probelm try your http://yourmachinename:yourportnumber instead.
Also careful you are not blocking cookies you will need it for jsessionid if not using url rewriting.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic