コード例 #1
0
  public String removeCheese() {
    Cheese tempCheese = new Cheese(getSelectedCheeseName(), "");
    Cheese storedCheese = service.find(tempCheese);
    if (storedCheese == null) {
      FacesContext.getCurrentInstance()
          .addMessage(null, new FacesMessage("Cheese " + tempCheese.getName() + "  Not Found!"));
      return "delete error";
    }

    service.remove(storedCheese);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Cheese Removed"));
    return "ok";
  }
コード例 #2
0
 public List getCheeses() {
   if (cheeses == null) {
     cheeses = new ArrayList(service.getCheeses());
   }
   return cheeses;
 }