Hello. Suppose, i created session object at www.foo.com (or http://localhost:8080). Could anyone explain me how to get this session object from different host my.foo.com (or http://localhost:8081). So if session object lives in memory on the servlet container it must be some ways to keep session in multihost environment.
It depends on your appserver - you'll have to RTFM. Sessions are based on host URLs, so a true "multi host" session object sharing isn't appropriate. A clustered host, on the other hand, really SHOULD be capable of shared sessions if it intends to fully support having any server in the cluster able to service requests.
An IDE is no substitute for an Intelligent Developer.