Home
What's
New?
com.oreilly.servlet
Servlet
Polls
Mailing
Lists
Servlet
Engines
Servlet
ISPs
Servlet
Tools
Documentation
Online
Articles
The
Soapbox
"Java
Servlet
Programming,
Second Edition"
"Java
Enterprise
Best Practices"
Speaking
& Slides
About
Jason
XQuery
Affiliate
Advertising
Info
|
Chapter 3 Examples from Java Servlet
Programming
- 3-1: A simple counter
- 3-2: A more holistic counter
- 3-3: A counter that reads init parameters
- 3-4: A fully persistent counter
- 3-6: On the hunt for primes
Examples from other chapters:
- Example 3.1: A simple counter
- This servlet counts and displays the number of times it has
been accessed since the last server reboot.
- Example 3.2: A more holistic counter
- This servlet counts the times it has been accessed, the number
of instances created by the server, and the total times all of
them have been accessed.
- Example 3.3: A counter that reads init parameters
- This servlet counts and displays the number of times it has
been accessed, and reads an init parameter to know what at what
number to begin counting.
- Example 3.4: A fully persistent counter
- This servlet counts and displays the number of times it has
been accessed, and saves the count to a file in its destroy()
method to make the count persistent.
- Example 3.6: On the hunt for primes
- This servlet searches for prime numbers above one quadrillion.
The algorithm it uses couldn't be simpler: it selects odd-numbered
candidates and attempts to divide them by every odd integer between
3 and their square root. If none of the integers evenly divides
the candidate, it is declared prime. It's disabled to let the
server's CPU handle important tasks.
- Try it (disabled for efficiency)
- Source
|