head 1.1; access; symbols IT1FALL00:1.1; locks; strict; comment @# @; 1.1 date 2000.11.10.20.51.04; author dbc; state Exp; branches; next ; desc @@ 1.1 log @Added Files: Counter.java.txt Headers.java.txt HelloUser.java.txt HelloWorld.java.txt InitCounter.java.txt MultiPart.java.txt MultiValue.java.txt Search.java.txt Students.java.txt VendingMachine.java.txt VendingMachine2.java.txt VendingMachine3.java.txt VendingView.java.txt VendingView2.java.txt VendingView3.java.txt headers.html headersEg.html hello.html helloUserEg.html index.html initCounterEg.html multipart.html multipartEg.html multivalue.html multivalueEg.html search.html searchEg.html students.html studentsEg.html vendingmachine2Eg.html vendingmachine3Eg.html vendingmachineEg.html web.xml @ text @ import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class VendingMachine2 extends HttpServlet { String [] snacks = {"Chips", "Popcorn", "Peanuts", "Snickers bar", "Twix", "Pop Tarts", "Chocolate Donut"} ; String selectURL = "http://sirah.csit.fsu.edu:8089/dbc/servlet/VendingMachine2" ; String viewURL = "http://sirah.csit.fsu.edu:8089/dbc/servlet/VendingView2" ; Random rand = new Random() ; static HashMap sessionTable = new HashMap() ; public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html"); String sessionID = request.getParameter("sessionID") ; if(sessionID == null) { sessionID = "" + rand.nextInt() ; sessionTable.put(sessionID, new Vector()) ; } else { Vector selections = (Vector) sessionTable.get(sessionID) ; String selection = request.getParameter("selection") ; if(selection != null) selections.addElement(selection) ; } PrintWriter out = response.getWriter(); out.println("
"); for(int i = 0 ; i < snacks.length ; i++) { out.println(""); } out.println(""); out.println(""); } } @