Application其实就是javax.servlet.ServletContext,所以用以下方法就可以:]
setAttribute(java.lang.String name, java.lang.Object object)
getAttribute(java.lang.String name) .
比如:
HashTable table = new HashTable();
application.setAttribute("online",table);
...
table = application.getAttribute("online");
...
setAttribute(java.lang.String name, java.lang.Object object)
getAttribute(java.lang.String name) .
比如:
HashTable table = new HashTable();
application.setAttribute("online",table);
...
table = application.getAttribute("online");
...
.....
Hashtable hash = new Hashtable(20, .20f);
hash.put("R1",new Rectangle(0, 0, 12, 21));
...//store
Rectangle R2 = (Rectangle)Hash.get("R1");
..//read