Product Home Page | Developer Site | Version | |
Increment the value of a counter with:
<% Counters.Increment(CounterName) %>
Increment and display the value of a counter with:
<%= Counters.Increment(CounterName) %>
To retrieve the value of a counter, use Counters.Get. To set a counter to a specific value, use Counters.Set.
The following code implements a one-line page-hit counter.
<P>There have been <%= Counters.Increment("hits") %> visits to this Web page. </P>
In this example, Counters.Increment increases the counter by one each time the client requests the page from the server.
Copyright © 2003 Sun Microsystems, Inc. All rights reserved.