Sharing JavaBeans
A JavaBean with an application scope is used by all clients accessing that application. To see an example of this:
- Download the
AccessCountBean.java and SharedCounts1.jsp, SharedCounts2.jsp, SharedCounts3.jsp files from www.corewebprogramming.com, and store at least the SharedCountsi.jsp files within the CoreWebProgramming webapp.
- Compile
AccessCountBean.java and put the AccessCountBean.class file in the cwp package in the CoreWebProgramming application, i.e., in %TOPMCAT_HOME%/webapps/CoreWebProgramming/WEB-INF/classes/cwp.
- Access the various
SharedCountsi.jsp files (in the same window or in multiple windows) and notice the cumulative access count.