• 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

getting session value in JSP

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
consider not to use such directive at all <%@ page session=""%>
nor true, nor false.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A teeny tiny vulgar attempt to get you to buy our stuff
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic