예제 #1
0
 public String addUrls() {
   urlsVO.setMsg(null);
   String msg = null;
   String checkStr = checkInput();
   if (!CommonUtil.isNullOrEmpty(checkStr)) msg = checkStr;
   else {
     UrlsBean urlsBean = new UrlsBean();
     urlsBean.setIcon("images/icon/ie.gif");
     urlsBean.setTitle(urlsVO.getTitle());
     urlsBean.setRemark(urlsVO.getRemark());
     urlsBean.setUrl(urlsVO.getUrl());
     try {
       urlsServer.addUrls(urlsBean);
       msg = "添加成功!";
       urlsVO.setTitle(null);
       urlsVO.setRemark(null);
       urlsVO.setUrl(null);
     } catch (Exception e) {
       e.printStackTrace();
       msg = "添加失败!";
     }
   }
   urlsVO.setMsg(msg);
   getUrlsList();
   return "urls";
 }
예제 #2
0
 private String checkInput() {
   if (CommonUtil.isNullOrEmpty(urlsVO.getTitle())) return "书签名不能为空!";
   if (CommonUtil.isNullOrEmpty(urlsVO.getUrl())) return "URL不能为空!";
   return null;
 }