• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please explain me

 
RR_ami
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HttpSession ses=request.getSession(true);

How can we access any method on reference on interface(HttpSession)
Because it is not possible to declared an object of interface(HttpSession).

please explain me?
 
Rodrigo Vieira
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use, for exemple:
ses.invalidate();
ses.getAttribute("test");
ses.isNew();
or all the other methods from interface HttpSession.
I didn�t get what you mean when you say => Because it is not possible to declared an object of interface(HttpSession).

ses is an Object of HttpSession...
 
Joy Mukherjee
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Container implements HTTPSession interface to create a Session Object for the User Session.
You have access to this session object by 3 methods

request.getSession(true); - Create One if not exist
request.getSession(false);- use existing dont create new
request.getSession(); - Create One if not exist

Thanks and Regards
Joy
 
Krzysztof Koziol
Ranch Hand
Posts: 133
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ses variable is a type of interface HttpSession. Every object that implmenets this interface may be assigned to this variable. The container provide its own implementation of session which implements the HttpSession. This implementation is available through HttpServletRequest.getSession() call.
 
Ramesh Ponnada
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its similar to below :

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic