Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Sessions Coding

 
Nithish Yalamanchili
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai All

Iam new to Servlets and JSP's. I need an application that accepts username and password from browser and place the user in session, so that the user can be checked for session. Please anyone provide code for this application.

Nithish
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At JavaRanch, we don't just provide code.
We prefer to help people learn how to code these things themselves.

What have you got so far?
What part has you confused?
 
Nithish Yalamanchili
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I have done upto here. From here where i have to place session object and track the user.



[BPSouther: Added code tags]
[ August 16, 2007: Message edited by: Ben Souther ]
 
prakash chandra
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You have to use Session Tracking in servlets. Session Tracking can be established using any one of the followings:
1. Cookies
2. URL rewriting and
3. Hidden Form Fields

Please go through above topics you will find your answer.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a session and store the username in the session.

You can see the javadoc for HTTPSession , you will find methods to set attribute in session.Check the javadoc for HTTPServletRequest for methods which will create HTTPSession.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tip before getting further : we usually use "equals" to compare strings.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic