File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference Between JSP and Servlet Session

 
Jimi Parekh
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there any difference between JSP and Servlet Sessions?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really, especially as JSPs are generally implemented as servlets. One difference is that JSP by default creates a session, while servlets do not.
 
ak pillai
author
Ranch Hand
Posts: 288
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes as ulf said by deafault no session is created but you can create a session by


<%@ page session="true">
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ak pillai:
Yes as ulf said by deafault no session is created but you can create a session by


<%@ page session="true">


You've got it backwards.
By default, JSPs create a session for you.
If you don't want your JSP to create a session, you have to use
<%@ page session="false">
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the application server creates an HttpSession for a user, that HttpSession is the same session used by every JSP and Servlet that user accesses. If you stuff some great data in the HttpSession in a Servlet, the client will be able to yank that data out of the HttpSession in any JSP or other Servlet in the application. Well, until their session times out, that is.

Here's more info on HttpSession objects:

http://www.technicalfacilitation.com/get.php?link=sessions

Regards,
[ August 27, 2006: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic