• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session...  RSS feed

 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir Iam again..with new problem..
..I want to log in user only once ..in my application than ..for whole application I donot want him to pass his username and password.again and again.that i know that we can mantain by session..
but how can ..
same one help me for that.
IAm using JSP and Oracle..
bye and take care
sandeep
 
kshitij raval
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) Take username and password as input in a simple JSP file
2) Then authenticate this username and password with the database
3) write this code to add username into a session:
session.putValue(String nameToRefer, Object toBeStoredAsSession);
e.g.,
String userName = "sandeepBalyan";
session.putValue("username", userName);
Then whenever you want to access this object just write,
session.getValue("username");
with regards,
Kshitij.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
session.putValue(), session.getValue() and session.removeAttribute() are deprecated as of Servlet 2.2.
You should use session.setAttribute(), session.getAttribute() and session.removeAttribute() respectively.
Check here for the current API (Servlet 2.3)
------------------
- Jessica Bradley
HP Bluestone
[This message has been edited by Jessica Bradley (edited November 02, 2001).]
 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for u r nice ans..
sandeep balyan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!