Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting in JSP page(URGENT)  RSS feed

 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
I am new to JSP. I like to know how to set session in JSP.
Please help me out.
Thanks
Ramkumar.c
 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramkumar
session is an implicit object like request,response etc..You don't need to create an instance of this object in JSP.
regards
sanj
 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
NO, the thing is i want to know how to set and retrieve session values in JSP pages.May be i look for a code.
Thanks in anticipation
Ramkumar.c
Originally posted by sanj singh:
Hi Ramkumar
session is an implicit object like request,response etc..You don't need to create an instance of this object in JSP.
regards
sanj

 
sanj singh
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ramkumar
Try doing this ..
session.setAttribute("nameForIdentification",object);
and then you can retrieve the object from the session this way...
session.getAttribute("nameForIdentification");
remember to cast the object to appropriate type.
Hope this helps.
regards
sanj
 
Pranit Saha
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.getValue();
Originally posted by ramkumar chandramohan:
hi,
NO, the thing is i want to know how to set and retrieve session values in JSP pages.May be i look for a code.
Thanks in anticipation
Ramkumar.c

 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramkumar, this forum has a search facility that you can use to quickly get this kind of information. Besides, any good JSP/servlet book will also have an explanation and example.
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramkumar, this forum has a search facility that you can use to quickly get this kind of information. Besides, any good JSP/servlet book will also have an explanation and example.
------------------
Bosun
SCJP for the Java� 2 Platform
 
ramkumar chandramohan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi sanj,
Thanks, it all works fine.
Ramkumar.c

Originally posted by sanj singh:
Hi Ramkumar
Try doing this ..
session.setAttribute("nameForIdentification",object);
and then you can retrieve the object from the session this way...
session.getAttribute("nameForIdentification");
remember to cast the object to appropriate type.
Hope this helps.
regards
sanj

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!