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

always print old session

Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
this is my jsp class


this is my servlet class



when i run this jsp and submit it always prints old session ?
why?
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

Samanthi perera wrote:
when i run this jsp and submit it always prints old session ?
why?


isNew() misleads many developers. isNew() will only return true if the server creates a session, but the client has not yet joined.

For example, turn off your cookies in your browser. Then run your application; it'll print "New Session" - Don't employ isNew to reliably check user authentication. Rely on user objects bound to sessions.
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
it works if i disable session on the jsp too.
anyway if new user comes the server gives a session ID for him with response.
then the next time user has the that ID .
when user fills the jsp file and submit .
why it dosn't happen here?
Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
I need to identify when first time loging user is a new one
and from second time onwords user is a old one
and i need to print new user or old user
can anyone change this example
?
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

Samanthi perera wrote:I need to identify when first time loging user is a new one
and from second time onwords user is a old one
and i need to print new user or old user
can anyone change this example
?


Is this a homework assignment? We're here to help, not do your hw. Try this:

In your servlet:



Samanthi perera
Ranch Hand

Joined: Jan 08, 2010
Posts: 510
thanks
Charles 'King
Ranch Hand

Joined: Jul 05, 2009
Posts: 56

Samanthi perera wrote:thanks


You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: always print old session