在asp中有一个Application对象,它类似于Session,但它在所有 session 之间共享......
http://msdn.microsoft.com/en-us/library/ms525360.aspx
You can use the Application object to share information among all users of a given application. An ASP-based application is defined as all the .asp files in a virtual directory and its subdirectories. Because the Application object can be shared by more than one user, there are Lock and Unlock methods to ensure that multiple users do not try to alter a property simultaneously.
我使用这个对象为小数据集实现一个简单的缓存...
什么是java/jsp等价物?
非常感谢...
最佳答案
ServletContext与ApplicationObject类似。您可以使用setAttribute方法添加所有用户共享的信息。在 servlet 中,您可以调用 getServletContext() 来访问它。但我不确定它是否提供锁定/解锁功能。
如果您使用 Spring 或其他 IoC 容器,您可以轻松定义所有用户都可以访问的 bean。我认为这对两个世界来说都是一个更好的解决方案。
关于java - asp的应用程序对象java相当于什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1006784/