Whatever server side language you're using, it must have a way to read and write cookies. When a user logs in, you can save their user name in a cookie, and whenever they access any page on your website, you can read the user name from the cookie and use it to authenticate them.
Are you using something like Spring MVC, Jersey, etc. or a very basic servlet with JAX-RS?
The best way to deal with this in my opinion is to setup your MVC framework with authentication middleware that handles all of this for you. The framework will then automatically authenticate the user before they hit a resource that requires authentication.
As i understand your problem , you have login page with username and password. Once you submit this form , it will go to first servlet after validating, if logged user is valid you are redirecting to home.jsp.
So when you are sending data to servlet(where you are validating whether it is valid user or not), in servlet you can set user in servlet after redirecting to home.jsp , you can get directly from session(implicit object in jsp) in
I hope you are clear!!
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad: