aspose file tools*
The moose likes JSP and the fly likes getting session value in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "getting session value in JSP" Watch "getting session value in JSP" New topic
Author

getting session value in JSP

dasari sudha
Greenhorn

Joined: Feb 20, 2005
Posts: 5
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

Joined: Feb 19, 2005
Posts: 77
consider not to use such directive at all <%@ page session=""%>
nor true, nor false.
Ariel Valentin
Ranch Hand

Joined: Jan 30, 2004
Posts: 44
<%@ 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. Valentin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting session value in JSP