Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
2.8 An Example Using Servlet Initialization and Page Modification Dates
47
Listing 2.11 LotteryNumbers.java (continued)
                "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
      out.println("  
  • " + numbers[i]);
  •     }
        out.println("" +
                    "");
      }
      /** The standard service method compares this date
       *  against any date specified in the If Modified Since
       *  request header. If the getLastModified date is
       *  later, or if there is no If Modified Since header,
       *  the doGet method is called normally. But if the
       *  getLastModified date is the same or earlier,
       *  the service method sends back a 304 (Not Modified)
       *  response, and does not call doGet.
       *  The browser should use its cached version of
       *  the page in such a case.
       */
      
      public long getLastModified(HttpServletRequest request) {
        return(modTime);
      }
      // A random int from 0 to 99.
      
      private int randomNum() {
        return((int)(Math.random() * 100));
      }
    }
    Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
    Servlet and JSP training courses by book's author: courses.coreservlets.com.
    
    
    
    
    
    
    footer
    
    
    
    
    

     

     

     

     

     Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

    jsp web hosting

     

    Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Jsp Web Hosting Cheapest Web Hosting

    Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved