Java Reference
In-Depth Information
To see how a session bean works, copy both of these JSPs to the < SERVER_ROOT >/djs/ direc-
tory and open your browser to the following URL:
http:// localhost /djs/SessionBean1.jsp
You should see an image similar to Figure 17.3.
F IGURE 17.3
The output from SessionBean1.jsp .
Click your reload button several times. You should see the count increase each time the page is
reloaded. Now use the same browser instance to open the following URL:
http:// localhost /djs/SessionBean2.jsp
You will see the count increment from the last count from the first JSP. This is because the
counter bean is stored in the session of the client.
Now open a completely new instance of the browser and you will see that the value of the
count property is reset. This is because each instance of a client creates its own instance of the
HttpSession , which is where the counter bean is stored.
Search WWH ::

Custom Search