Esempio n. 1
0
 @Override
 public void list() throws IOException {
   response.setCharacterEncoding(Constants.CHARSET);
   PrintWriter out = null;
   try {
     out = getOut(response);
     if (null != articleManager) {
       int c = articleManager.getTotalBySql(entity);
       if (c > 0) {
         List<Article> list = articleManager.getListBySql(entity, start, limit);
         if (null != list && list.size() > 0) {
           String json = ExtUtil.getJsonFromList(c, list);
           out.println(json);
         } else {
           out.println("{success:false,msg:'列表数据为空!'}");
         }
       } else {
         out.println("{success:false,msg:'没有数据!'}");
       }
     } else {
       out.println("{success:false,msg:'业务类获取失败,请检查!'}");
     }
   } catch (Exception e) {
     out.println("{success:false,msg:'异常【" + e.getMessage() + "】'}");
   } finally {
     if (null != out) {
       out.flush();
       out.close();
     }
   }
 }
Esempio n. 2
0
 /** 设置文章缩略图 */
 public void previewicon() throws Exception {
   response.setCharacterEncoding(Constants.CHARSET);
   PrintWriter out = null;
   try {
     out = getOut(response);
     Article article = articleManager.get(entity.getId());
     if (!article.getActicleXmlUrl().toLowerCase().endsWith(".xml")) {
       article.setActicleXmlUrl(entity.getActicleXmlUrl());
       articleManager.save(article);
       out.println("{success:true,msg:'设置文章缩略图成功!'}");
     } else {
       out.println("{success:false,msg:'该类数据不允许设置缩略图!'}");
     }
   } catch (Exception e) {
     out.println("{success:false,msg:'异常【" + e.getMessage() + "】'}");
   } finally {
     if (null != out) {
       out.flush();
       out.close();
     }
   }
 }