As you have found out, the whole purpose of Sun's servlet API is to keep web apps totally separate so you will have to go outside the servlet API to do this. There are plenty of options, for instance a separate database, RMI, etc. Bill
Joined: Mar 09, 2001
Bill, Is there a reason why you shouldn't be able to do that? I couldnt come up with one. BTW all my applications reside in the same server. I appreciate your help on this. Thanks, Srini
Suppose to create one class and use singleton pattern to create only one instance in one init() of servlets, we can use this instance to share data between multi web apps. Am I missing something?
Author and all-around good cowpoke
Joined: Mar 22, 2000
Creating a class shared by both applications only works if both use the same ClassLoader - I don't think you can rely on it. As I said, Sun's design requires "Web Applications" to be completely separate and independent. The reason being they want to encourage the sale of web applications and interactions between web applications would cause endless debugging problems. The solution is to run an entirely separate application that any web application servlet can talk to and share data. This is easily done - you have several options. Chapter 9 in my servlets & JSP book works out an example using a Chat server as an example. Bill