Hi there, I have a servlet in one domain that sets a session variable and displays a link to a servlet in another domain. When the client clicks on the link, I'd like to validate the session variable set in the initiating domain. Is it possible to retrieve session variables across domains? Thanks, Mike
if you have multiple sites on the same server you can use application level variables between them Hmm. I think this is unlikely. "different sites on the same server" are almost always implemented as either separate servlet containers attached to a "front door" web server such as apache, or as separate web applications in a single container. Both of these cases will not allow the sharing of application- or sesion- level information. To share anything between separate web applications you usually need to either store the information somewhere that both applications can read from (a database, JNDI, a file etc.), or use a network-based protocol (FTP, HTTP, web services, RMI, ...) to transfer it directly from one application to another.
OK, what you're referring to is a limitation set in the Servlet Spec that Session scope is limited to an individual web app. Actually, some Application Server vendors (such as WebSphere) provide special configuration switches that relax this constraint, but if you use them, you are now no longer writing a portable application. If that's not a concern to you, and you're using a server with that capability, more power to you. On the other hand, to write something like this in a J2EE-compliant way, I'd suggest you store the "shared" information in something like a shared database, perhaps keyed by a value placed in a cookie. Kyle [ January 01, 2004: Message edited by: Kyle Brown ]
Hey gang, Thanks for all that input. As of today, I decided to move the apps under the same domain which of course solved this issue all together. Thanks again for your assistance! Mike