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);