Esempio n. 1
0
 private String processDelete(String parameter) {
   if (parameter != null) {
     try {
       Item read = newItemDao.read(Long.valueOf(parameter));
       if (read != null) {
         newItemDao.delete(read);
         return "delete: " + read.toString();
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return null;
 }
Esempio n. 2
0
 private String processCreate(String parameter) {
   if (parameter != null) {
     Item create = newItemDao.create(new Item(parameter, parameter, null));
     return "create: " + create.toString();
   }
   return null;
 }
Esempio n. 3
0
 @Override
 protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   String processGet = processGet(req.getParameter("get"));
   StringBuilder all = new StringBuilder();
   List<Item> findAll = newItemDao.findAll();
   for (Item i : findAll) {
     all.append(i).append("<br/>");
   }
   writePage(resp, null, null, processGet, all);
 }