cartbean.java
来自「采用MVC模式,完成了对用户的管理(删除用户),对图书的管理(增,删,改,查),」· Java 代码 · 共 35 行
JAVA
35 行
package cart;
import javax.ejb.Stateful;
import java.util.*;
import javax.ejb.Remove;
@Stateful
public class CartBean implements CartRemote{
private String customerName;
private ArrayList<String> contents;
public void initialize(String person)// throws BookException
{
customerName = person;
contents = new ArrayList<String>();
}
public String getCustomerName(){
return customerName;
}
public void addBook(String title) {
contents.add(title);
}
public void removeBook(String title)// throws BookException
{
boolean result = contents.remove(title);
}
public List<String> getContents() {
return contents;
}
@Remove()
public void remove() {
contents = null;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?