FileDocCategorySizeDatePackage
AdMaker.javaAPI DocExample1251Wed Apr 05 11:25:42 BST 2000None

AdMaker

public class AdMaker extends HttpServlet

Fields Summary
static String[]
adText
int
currentAd
Constructors Summary
Methods Summary
public voiddoGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)

 

       
       
    
    String adContent;
    PrintWriter out = resp.getWriter();
    synchronized(this) {
      adContent = adText[currentAd];
      currentAd++;
      if (currentAd >= adText.length)
        currentAd = 0;
    } 
    String title = req.getParameter("pagetitle");
    if(title != null)
      out.println(title + " is brought to you by");
    else
      out.println("This page is brought to you by");
    out.println(adContent);