该源码为JSP的开发案例集锦

源代码在线查看: buy.java

软件大小: 6034 K
上传用户: sheng_xia
关键词: JSP 源码 案例 集锦
下载地址: 免注册下载 普通下载 VIP

相关代码

				package ch4;
				import java.util.Vector;
				import java.util.Enumeration;
				public class Buy {
				    Vector v = new Vector();
				    String submit = null;
				    String item = null;
				    private void addItem(String name) {
						v.addElement(name);
				    }
				    private void removeItem(String name) {
						v.removeElement(name);
				    }
				    public void setItem(String name) {
						item = name;
				    }
				    public void setSubmit(String s) {
						submit = s;
				    }
				    public String[] getItems() {
						String[] s = new String[v.size()];
						v.copyInto(s);
						return s;
				    }
				    public void processRequest() {
						if (submit.equals("add"))
						    addItem(item);
						else if (submit.equals("remove")) 
						    removeItem(item);	
						// reset at the end of the request
						reset();
				    }
				    private void reset() {
						submit = null;
						item = null;
				    }
				}
							

相关资源