📄 cartbean.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -