home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-tomcat-addon-1.4.9-installer.exe / DummyCart.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-05-17  |  1.6 KB  |  53 lines

  1. package sessions;
  2.  
  3. import java.util.Vector;
  4. import javax.servlet.http.HttpServletRequest;
  5.  
  6. public class DummyCart {
  7.    // $FF: renamed from: v java.util.Vector
  8.    Vector field_0 = new Vector();
  9.    String submit = null;
  10.    String item = null;
  11.  
  12.    private void addItem(String name) {
  13.       this.field_0.addElement(name);
  14.    }
  15.  
  16.    private void removeItem(String name) {
  17.       this.field_0.removeElement(name);
  18.    }
  19.  
  20.    public void setItem(String name) {
  21.       this.item = name;
  22.    }
  23.  
  24.    public void setSubmit(String s) {
  25.       this.submit = s;
  26.    }
  27.  
  28.    public String[] getItems() {
  29.       String[] s = new String[this.field_0.size()];
  30.       this.field_0.copyInto(s);
  31.       return s;
  32.    }
  33.  
  34.    public void processRequest(HttpServletRequest request) {
  35.       if (this.submit == null) {
  36.          this.addItem(this.item);
  37.       }
  38.  
  39.       if (this.submit.equals("add")) {
  40.          this.addItem(this.item);
  41.       } else if (this.submit.equals("remove")) {
  42.          this.removeItem(this.item);
  43.       }
  44.  
  45.       this.reset();
  46.    }
  47.  
  48.    private void reset() {
  49.       this.submit = null;
  50.       this.item = null;
  51.    }
  52. }
  53.