package coreservlets; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Example using servlet initialization and the * getLastModified method. *
* Taken from Core Servlets and JavaServer Pages
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* © 2000 Marty Hall; may be freely used or adapted.
*/
public class LotteryNumbers extends HttpServlet {
private long modTime;
private int[] numbers = new int[10];
/** The init method is called only when the servlet
* is first loaded, before the first request
* is processed.
*/
public void init() throws ServletException {
// Round to nearest second (ie 1000 milliseconds)
modTime = System.currentTimeMillis()/1000*1000;
for(int i=0; i" + title + "
\n" +
"Based upon extensive research of " +
"astro-illogical trends, psychic farces, " +
"and detailed statistical claptrap, " +
"we have chosen the " + numbers.length +
" best lottery numbers for you." +
"");
for(int i=0; i
" +
"