Example #1
0
  // 修改成员信息
  public String UpdateMember() throws Exception {
    UserDAO uDAO = null;
    String retMess = "UpdateMemberFailed";

    try {
      uDAO = DAOFactory.getUserDAOInstance();
      User user = new User();
      // 获得uId
      setUserId(Integer.parseInt(ServletActionContext.getRequest().getParameter("uId")));

      user.setuId(getUserId());
      user.setuMgr(getUserMgr());
      user.setuEducation(getUserEducation());

      if (uDAO.doUpdateMember(user)) {
        ArrayList<User> uList = (ArrayList<User>) uDAO.doSelectById(getUserId());

        HttpServletRequest request = ServletActionContext.getRequest();
        request.setAttribute("uList", uList);

        ArrayList<String> mgrList = (ArrayList<String>) uDAO.doSelectAllMgr(getUserId());
        request.setAttribute("mgrList", mgrList);

        retMess = "UpdateMember";
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return retMess;
  }
Example #2
0
 public String execute() {
   User user = (User) ServletActionContext.getRequest().getSession().getAttribute("user");
   comment = commentService.addComment(mblogID, user.getUserId(), content);
   List<Comment> list = commentService.getByMblog(mblogID);
   ServletActionContext.getRequest().getSession().setAttribute("commentlist", list);
   return SUCCESS;
 }
Example #3
0
 /**
  * 退出Action
  *
  * @return
  */
 public String logout() {
   log.debug("===> invoke logout Action");
   ServletActionContext.getRequest().getSession().removeAttribute("user");
   msg = "成功退出";
   ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
   return INPUT;
 }
  public String execute() throws Exception {
    String a_editNoticeId = ServletActionContext.getRequest().getParameter("editNoticeId");
    a_editNoticeId = URLDecoder.decode(a_editNoticeId, "utf-8");
    String a_editNoticeDetail = ServletActionContext.getRequest().getParameter("editNoticeDetail");
    a_editNoticeDetail = URLDecoder.decode(a_editNoticeDetail, "utf-8");
    String a_editNoticeReleaser =
        ServletActionContext.getRequest().getParameter("editNoticeReleaser");
    a_editNoticeReleaser = URLDecoder.decode(a_editNoticeReleaser, "utf-8");
    String a_editNoticePublishtime =
        ServletActionContext.getRequest().getParameter("editNoticePublishtime");
    a_editNoticePublishtime = URLDecoder.decode(a_editNoticePublishtime, "utf-8");

    String sql =
        "update notice set detail='"
            + a_editNoticeDetail
            + "',publishtime='"
            + a_editNoticePublishtime
            + "',releaser='"
            + a_editNoticeReleaser
            + "' where id='"
            + a_editNoticeId
            + "'";

    GetUpdate.updata(sql);

    return "success";
  }
Example #5
0
  public String saveServicePriceToSession() throws Exception {
    Map<String, Object> rt = new HashMap<String, Object>();
    String returnType = ServletActionContext.getRequest().getParameter("returnType");
    String serviceIdDetail = ServletActionContext.getRequest().getParameter("serviceIdDetail");
    String catalogNo = ServletActionContext.getRequest().getParameter("catalogNo");
    String key = null;
    if ("serviceId".equals(returnType)) {
      servicePrice.setServiceId(Integer.valueOf(serviceIdDetail));
      key = servicePrice.getCatalogId() + "_" + servicePrice.getServiceId();
    } else {
      List<com.genscript.gsscm.serv.entity.Service> serv =
          this.servService.getServiceByCatalogNo(catalogNo);
      servicePrice.setServiceId(serv.get(0).getServiceId());
      key = servicePrice.getCatalogId() + "_" + catalogNo;
    }

    ServicePrice sp =
        this.servService.getServicePriceByServiceIdAndCatalogId(
            servicePrice.getCatalogId(), servicePrice.getServiceId());
    if (sp == null) {
      sp = servicePrice;
    } else {
      sp.setLimitPrice(servicePrice.getLimitPrice());
      sp.setStandardPrice(servicePrice.getStandardPrice());
      sp.setPriceRuleGroup(servicePrice.getPriceRuleGroup());
      sp.setCategoryId(servicePrice.getCategoryId());
    }
    SessionUtil.updateOneRow(SessionPdtServ.ServicePricing.value(), sessionServiceId, key, sp);
    rt.put("key", key);
    rt.put("message", SUCCESS);
    Struts2Util.renderJson(rt);
    return null;
  }
Example #6
0
 /** 获得系数列表; */
 @SuppressWarnings("unchecked")
 public void showAll() {
   try {
     String barId = ServletActionContext.getRequest().getParameter("barId");
     ExtLimit limit =
         (ExtLimit)
             EntityReflect.createObjectFromRequest(
                 ServletActionContext.getRequest(), ExtLimit.class);
     BarProportion barProportion =
         (BarProportion)
             EntityReflect.createObjectFromRequest(
                 ServletActionContext.getRequest(), BarProportion.class);
     barProportion.setExtLimit(limit);
     barProportion.setBarId(TypeConverterUtil.parseInt(barId));
     int count = barProportionService.selectLimitCount(barProportion);
     List<Department> barProportionList = barProportionService.selectByLimit(barProportion);
     AjaxOut.responseJSonGrid(
         ServletActionContext.getResponse(),
         barProportionList,
         count,
         new SimpleDateFormat("yyyy-MM-dd"));
   } catch (Exception e) {
     logger.error("", e);
   }
 }
 public String getGroupDetails() {
   GroupDAO grp = new GroupDAOImpl();
   System.out.println("group_id     " + group_id);
   setGroupDetail(null);
   HttpSession session = ServletActionContext.getRequest().getSession(false);
   User u = (User) session.getAttribute("user");
   if (!(group_id == null)) {
     setGroupDetail(grp.getGroupDetails(group_id, Integer.parseInt(u.getUserId())));
     System.out.println("group id" + groupDetail.getGroup_id());
     System.out.println("group name" + groupDetail.getGroup_name());
   }
   NewsFeedAction n = new NewsFeedAction();
   setGrpList(grp.getAllGroups(Integer.parseInt(u.getUserId())));
   setFeedList(n.getGroupNewsFeed(group_id));
   int i = 0;
   while (i < grpList.size()) {
     System.out.println(grpList.get(i).getGroup_id());
     i++;
   }
   i = 0;
   System.out.println("post..................");
   while (i < feedList.size()) {
     System.out.println(feedList.get(i).getPostId());
     i++;
   }
   HttpServletRequest request = ServletActionContext.getRequest();
   request.setAttribute("groupDetail", groupDetail);
   request.setAttribute("grpList", grpList);
   request.setAttribute("groupDetail", groupDetail);
   return "success";
 }
Example #8
0
  /**
   * 登录Action
   *
   * @return
   */
  public String login() {
    log.debug("=======> invoke login Action");
    if (this.user.getUsername() == null || "".equals(this.user.getUsername())) {
      msg = "用户名不能为空";
      ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
      return INPUT;
    }

    if (this.user.getPassword() == null || "".equals(this.user.getPassword())) {
      msg = "密码不能为空";
      ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
      return INPUT;
    }

    this.user = userService.login(this.user.getUsername(), this.user.getPassword());

    if (user == null) {
      msg = "用户名与密码不匹配";
      ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
      return INPUT;
    } else {
      ActionContext.getContext().getSession().put("user", user);
      msg = "登录成功";
      ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
      return SUCCESS;
    }
  }
Example #9
0
 // 客服设置首页商品
 public String getGoods() {
   String shopId = ServletActionContext.getRequest().getParameter("shop");
   String key = ServletActionContext.getRequest().getParameter("keyword");
   System.out.println("shopId" + shopId);
   String pageNo = ServletActionContext.getRequest().getParameter("page.pageNo");
   String pageSize = ServletActionContext.getRequest().getParameter("page.pageSize");
   if (pageNo != null && pageSize != null) {
     pagegoods.setPageNo(Integer.parseInt(pageNo));
     pagegoods.setPageSize(Integer.parseInt(pageSize));
   }
   if (shopId.equals("全部店铺")) {
     pagegoods = goodsService.getByShopKey(pagegoods, "0", key);
   } else {
     pagegoods = goodsService.getByShopKey(pagegoods, shopId, key);
   }
   // page = goodsService.getShop(page, Integer.parseInt(shopId));
   if (pagegoods != null && pagegoods.getTotalItems() > 0) {
     request.put("msg", "");
   } else {
     request.put("msg", "没有符合条件的记录,请重新查询");
   }
   request.put("page", pagegoods);
   List<Shop> list = shopService.getByState();
   request.put("ShopList", list);
   return "TopGoods";
 }
  /**
   * 保存地址
   *
   * @throws IOException
   */
  public void addAdress() throws IOException {
    ids = ServletActionContext.getRequest().getParameter("ids");
    goodowner = ServletActionContext.getRequest().getParameter("goodowner");
    addressOwner = ServletActionContext.getRequest().getParameter("addressOwner");
    phonenumerowner = ServletActionContext.getRequest().getParameter("phonenumerowner");
    ids = ServletActionContext.getRequest().getParameter("ids");
    List<GoodStore> listGoodStore = goodStoreService.getMyStore(id);
    String str[] = ids.split(",");
    int array[] = new int[str.length];
    GoodAddress goodAddress = new GoodAddress();
    goodAddress.setAddressOwner(addressOwner);
    goodAddress.setGoodowner(goodowner);
    goodAddress.setPhonenumerowner(phonenumerowner);

    int f = goodAdressServiceImpl.saveAddress(goodAddress);

    try {
      for (int i = 0; i < str.length; i++) {
        array[i] = Integer.parseInt(str[i]);
        goodStore = goodStoreService.getGoodsStore(array[i]);
        goodStore.setAddressId(f);
        goodStoreService.saveOrUpdate(goodStore);
      }
      m.put("msg", "1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    } catch (Exception e) {
      e.printStackTrace();
      m.put("msg", "-1");
      ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
    }
  }
Example #11
0
  @Override
  public String execute() throws Exception {
    userid = -1;
    HttpSession httpSession = ServletActionContext.getRequest().getSession();
    Cookie[] cookies = ServletActionContext.getRequest().getCookies();
    for (Cookie cookie : cookies) {
      if (cookie.getName().equals("userid")) {
        userid = Integer.parseInt(cookie.getValue());
      }
      if (cookie.getName().equals("useremail")) {
        useremail = cookie.getValue();
      }
      if (cookie.getName().equals("usernick")) {
        usernike = Base64Util.decodeToString(cookie.getValue());
      }
    }

    if (userid == -1 || useremail == null || usernike == null) {
      return "session";
    } else {
      System.out.println(userid);
      list = UserInforDao.selectLoginInfor(userid);
      for (int i = 0; i < list.size(); i++) {
        list.get(i).setHostname(Base64Util.decodeToString(list.get(i).getHostname()));
      }
      size = list.size();
    }

    return SUCCESS;
  }
Example #12
0
 @Override
 public String execute() throws Exception {
   if (username == null || password == null) {
     HttpServletRequest request = ServletActionContext.getRequest();
     request.setAttribute("msg", "*请先登录之后再访问!");
     return "login_permission";
   }
   Connection conn = ConnectionFactory.newInstance().makeConnection();
   String sql = "SELECT * FROM customer WHERE first_name = ? AND last_name = ?";
   HttpServletRequest request = ServletActionContext.getRequest();
   try {
     PreparedStatement ps = conn.prepareCall(sql);
     ps.setString(1, username);
     ps.setString(2, password);
     ResultSet rs = ps.executeQuery();
     if (rs.next()) { // 用户名和密码验证通过
       request.getSession().setAttribute("user", username);
       request.removeAttribute("msg");
     } else {
       RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
       request.setAttribute("msg", "* 用户名或密码错误,请重新登录!");
       return "login_fail";
     }
   } catch (SQLException e) {
     e.printStackTrace();
     return "login_fail";
   }
   return "login_success";
 }
  public String auctionDetailAll() {
    logger.info("11111___________");
    String auctionFlag = ServletActionContext.getRequest().getParameter("auctionFlag");
    if (auctionFlag == null) return "auctionDetailAll";
    String detailType = ServletActionContext.getRequest().getParameter("detailType");

    String returnVal = "";
    AuctionInfoDtoIndex auctionInfoDtoIndex = iAuctionInfo.getAuctionInfoIndexDto(auctionFlag);
    if (auctionInfoDtoIndex == null || ("0").equals(auctionInfoDtoIndex.getPublishFlag())) {
      return "sessionDestory";
    }
    if ("1".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionBulletin();
    } else if ("2".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionNotice();
    } else if ("3".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionGuide();
    } else if ("4".equals(detailType)) {
      returnVal = auctionInfoDtoIndex.getAuctionDescription();
    } else {

    }
    ServletActionContext.getRequest().setAttribute("returnVal", returnVal);
    return "auctionDetailAll";
  }
Example #14
0
 // zz for shopGoods
 public String sdetial() {
   String sid = "";
   if (ServletActionContext.getRequest().getParameter("sid") != null) {
     sid = ServletActionContext.getRequest().getParameter("sid");
     String pageNo = ServletActionContext.getRequest().getParameter("page.pageNo");
     String pageSize = ServletActionContext.getRequest().getParameter("page.pageSize");
     // System.out.println("no-"+pageNo+"size-"+pageSize);
     if (pageNo != null && pageSize != null) {
       pagegoods.setPageNo(Integer.parseInt(pageNo));
       pagegoods.setPageSize(Integer.parseInt(pageSize));
     }
   } else {
     sid = session.get("shopid").toString();
   }
   Shop shop = shopService.get(Integer.parseInt(sid));
   request.put("shop", shop);
   // System.out.println("no-"+pagegoods.getPageNo()+"size-"+pagegoods.getPageSize());
   pagegoods = goodsService.getShop(pagegoods, Integer.parseInt(sid));
   if (pagegoods != null && pagegoods.getTotalItems() > 0) {
     request.put("msg", "");
   } else {
     request.put("msg", "该店铺尚未添加商品");
   }
   request.put("page", pagegoods);
   return "lists";
 }
  public String uploadImage() {

    System.out.println("1111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();
    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;
      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = up.getAlbumName(getAlbumId());
      destpath = StringUtils.photoPath + File.separator + user.getUserId() + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        return ERROR;
      }
    }
    // if(friendId==null || friendId=="")
    // {
    user_id = user.getUserId();
    setUser_id(user_id);
    up.uploadImage(df.format(dateobj).toString(), albumId, picFileName);
    Integer aid = albumId;
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());
    request.setAttribute("imageList", imageList);

    // }
    // else{
    /*NewsFeedDAOImpl nfd=new NewsFeedDAOImpl();
    String userName=nfd.getFullUserName(friendId);

    up.postOnWall(postDesc, user.getUserId(),friendId,  df.format(dateobj).toString(),userName+" status Update","timeline",youtubeLink,picFileName);*/
    // }
    addActionMessage("Content has been posted successfully.");
    return "success";
  }
  public String imageDetail() {
    logger.info("11111___________");
    String imgUrl = ServletActionContext.getRequest().getParameter("imgUrl");
    if (imgUrl == null) return "sessionDestory";

    ServletActionContext.getRequest().setAttribute("imgUrl", imgUrl);
    return "imageDetail";
  }
Example #17
0
  public String toNewPage() {
    int urlsId = Integer.valueOf(ServletActionContext.getRequest().getParameter("urlsId"));
    String newurl = ServletActionContext.getRequest().getParameter("url").toString();
    urlsVO.setLocation(newurl);
    urlsServer.addUrlsUsedCount(urlsId);

    return "urls";
  }
 public String execute() throws Exception {
   String choose = ServletActionContext.getRequest().getParameter("choosen");
   choose = URLDecoder.decode(choose, "utf-8");
   // System.out.println(choose);
   ServletContext application = ServletActionContext.getRequest().getSession().getServletContext();
   application.setAttribute("method", choose);
   System.out.println(application.getAttribute("method"));
   return "success";
 }
 public void delete() {
   if (delfile != null) {
     this.getInsertDB().delShareFile(this.delfile);
     String realpath = ServletActionContext.getRequest().getRealPath(inputPath);
     File file = new File(realpath + "\\" + delfile);
     if (file != null) {
       file.delete();
     }
   }
 }
 /** 停止策略 */
 public void stopTactics() throws Exception {
   HttpServletRequest request = ServletActionContext.getRequest();
   String msg = "";
   ServletActionContext.getResponse().setCharacterEncoding("UTF-8");
   ServletActionContext.getRequest().setCharacterEncoding("UTF-8");
   int nmDataGetterTaskId = ReqUtils.getReqInt(request, "ids");
   keywordsTacticsImpl.stopTatctics(nmDataGetterTaskId);
   msg = "停止策略成功!";
   Struts2Utils.renderText(msg);
 }
Example #21
0
  public String addConfig() {
    String name = ServletActionContext.getRequest().getParameter("name");
    String open_state = ServletActionContext.getRequest().getParameter("open_state");
    String whiteList = ServletActionContext.getRequest().getParameter("whiteList");
    String showNum = ServletActionContext.getRequest().getParameter("showNum");
    String repeatNum = ServletActionContext.getRequest().getParameter("repeatNum");
    String showTimeInterval = ServletActionContext.getRequest().getParameter("showTimeInterval");
    String timeSlot = ServletActionContext.getRequest().getParameter("timeSlot");

    boolean open = "1".equals(open_state) ? true : false;
    int showN = 0;
    if (!StringTools.isEmpty(showNum)) showN = Integer.parseInt(showNum);

    int repeatN = 1;
    if (!StringTools.isEmpty(repeatNum)) repeatN = Integer.parseInt(repeatNum);

    float showTime = 0;
    if (!StringTools.isEmpty(showTimeInterval)) showTime = Float.parseFloat(showTimeInterval);
    // 媒体
    List<GMedia> medias = mediaService.findAlls(0).getList();
    String appSwitch = "";
    for (GMedia media : medias) {
      String p = ServletActionContext.getRequest().getParameter("appSwitch_" + media.getId());
      if (p != null) appSwitch = appSwitch + media.getId() + ":" + media.getPackageName() + ",";
    }
    if (appSwitch.endsWith(",")) appSwitch = appSwitch.substring(0, appSwitch.length() - 1);
    // 广告位
    List<GAdPosition> adPositions = adPositionService.findAlls().getList();
    String adPositionSwitch = "";
    for (GAdPosition adPosition : adPositions) {
      String p =
          ServletActionContext.getRequest()
              .getParameter("adPositionSwitch_" + adPosition.getType());
      if (p != null) adPositionSwitch = adPositionSwitch + adPosition.getType() + ",";
    }
    if (adPositionSwitch.endsWith(","))
      adPositionSwitch = adPositionSwitch.substring(0, adPositionSwitch.length() - 1);

    // 时间段
    if (timeSlot.endsWith(",")) timeSlot = timeSlot.substring(0, timeSlot.length() - 1);

    if (open) {
      List<GAdConfig> list = adConfigService.findAlls(0).getList();
      for (GAdConfig con : list) {
        if (con.getOpen()) {
          con.setOpen(false);
          adConfigService.update(con);
        }
      }
    }

    GAdConfig adConfig =
        new GAdConfig(
            name, open, whiteList, timeSlot, showN, repeatN, showTime, appSwitch, adPositionSwitch);
    adConfigService.add(adConfig);

    ActionContext.getContext().put("addConfig", "添加成功!");

    return list();
  }
Example #22
0
 public String execute() throws Exception {
   CommodityDAO commodityDAO = CommodityDAOFactory.getCommodityDAOInstance();
   List<Commodity> commodityList = commodityDAO.findAllCommodity();
   Page page = PageUtil.createPage(5, commodityList.size(), currentPage);
   int endIndex = page.getBeginIndex() + page.getEveryPage();
   if (page.getBeginIndex() + page.getEveryPage() > page.getTotalCount()) {
     endIndex = page.getTotalCount();
   }
   commodityList = commodityList.subList(page.getBeginIndex(), endIndex);
   ServletActionContext.getRequest().setAttribute("commodityList", commodityList);
   ServletActionContext.getRequest().setAttribute("page", page);
   return "success";
 }
  public String viewScore() throws Exception {
    try {
      int id = 0;
      if (ServletActionContext.getRequest().getParameter("scid") != null) {
        id = Integer.parseInt(ServletActionContext.getRequest().getParameter("scid").toString());
      }
      setSc(scoreService.getScore1(id));
      return "viewScore";

    } catch (Exception e) {
      return ERROR;
    }
  }
 public String guideDetail() {
   logger.info("11111___________");
   String guideFlag = ServletActionContext.getRequest().getParameter("guideFlag");
   if (guideFlag == null) {
     return "sessionDestory";
   }
   AuctionGuide auctionGuide = iAuctionGuide.getAuctionGuide(guideFlag);
   if ("1".equals(auctionGuide.getDeleteFlag())) {
     return "sessionDestory";
   }
   ServletActionContext.getRequest().setAttribute("auctionGuide", auctionGuide);
   return "guideDetail";
 }
  public String uploadGroupImage() {

    System.out.println("pic upload action............1111111111111111111111111111111" + albumId);
    HttpSession session = ServletActionContext.getRequest().getSession(false);
    User user = (User) session.getAttribute("user");
    System.out.println("UserPostAction Photo===>" + picFileName);
    System.out.println("UserPostAction Photo===>" + picContentType);
    System.out.println("UserPostAction Photo===>" + pic);
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date dateobj = new Date();
    UserImageUploadDAO up = new UserImageUploadDAOImpl();
    String destpath = "";
    String imageExtension = "";
    if (picContentType != null && picContentType.contains("jpeg")) {
      imageExtension = ".jpeg";
    } else if (picContentType != null && picContentType.contains("png")) {
      imageExtension = ".png";
    } else if (picContentType != null && picContentType.contains("gif")) {
      imageExtension = ".gif";
    } else if (picContentType != null && picContentType.contains("jpg")) {
      imageExtension = ".jpg";
    }
    if (picFileName != null) {
      Random randomGenerator = new Random();
      Integer randomInt = randomGenerator.nextInt(1000000);
      picFileName = randomInt.toString() + imageExtension;
      System.out.println("UserPostAction Photo===>" + picFileName);

      String name = up.getAlbumName(getAlbumId());
      destpath = StringUtils.groupPhotoPath + File.separator + group_id + "_" + name;
      System.out.println("Server path:" + destpath);
      File destFile = new File(destpath, picFileName);
      try {
        FileUtils.copyFile(pic, destFile);
      } catch (IOException e) {
        System.out.println("error occurred");
        e.printStackTrace();
        return ERROR;
      }
    }
    up.uploadImage(df.format(dateobj).toString(), albumId, picFileName);
    Integer aid = albumId;
    HttpServletRequest request = ServletActionContext.getRequest();
    request.setAttribute("albumId", aid.toString());
    request.setAttribute("imageList", imageList);
    getGroupDetails();
    // addActionMessage("Content has been posted successfully.");
    System.out.println("action pic upload done................................................");
    return "success";
  }
Example #26
0
 public String validatePing() {
   String ip = ServletActionContext.getRequest().getParameter("ip");
   int port = Integer.parseInt(ServletActionContext.getRequest().getParameter("port"));
   String pageOut = "fail";
   boolean ping = PingUtils.ping(ip, port);
   if (!ping) {
     AppLogger.daemonErrorLogger.error(
         String.format("validate ip:%s,port:%s cannot ping!", ip, port));
   } else {
     pageOut = "success";
   }
   PageIOUtils.printToPage(pageOut);
   return NONE;
 }
Example #27
0
  /**
   * 修改密码Action
   *
   * @return
   */
  public String changePassword() {
    log.debug("===> invoke changePassword Action");
    // 判断用户名是否为空
    if (this.user.getUsername() == null || "".equals(this.user.getUsername())) {
      msg = "用户名不能为空!";
      ActionContext.getContext().getSession().put("msg", msg);
      return INPUT;
    }

    // 判断密码是否为空
    if (this.user.getPassword() == null || "".equals(this.user.getPassword())) {
      msg = "密码不能为空!";
      ActionContext.getContext().getSession().put("msg", msg);
      return INPUT;
    }

    // 判断确认密码是否为空
    if (this.repassword == null || "".equals(this.repassword)) {
      msg = "请确认密码!";
      ActionContext.getContext().getSession().put("msg", msg);
      return INPUT;
    }

    // 判断两次输入密码是否一致
    if (!this.repassword.equals(this.user.getPassword())) {
      msg = "两次输入密码不一致!";
      ActionContext.getContext().getSession().put("msg", msg);
      return INPUT;
    }

    this.user = userService.findUserByName(user.getUsername()); // 通过用户名查找到用户信息
    if (user != null) {
      user.setPassword(this.repassword);
      // 修改用户密码
      this.user = this.userService.changePassword(user);
      if (this.user != null) {
        msg = "修改密码成功";
        ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
        ServletActionContext.getRequest().getSession().setAttribute("user", user);
        return SUCCESS;
      } else {
        msg = "修改密码失败";
        ServletActionContext.getRequest().getSession().setAttribute("msg", msg);
        return INPUT;
      }
    } else {
      return INPUT;
    }
  }
Example #28
0
 public String removeTrigger() {
   try {
     String jobName = ServletActionContext.getRequest().getParameter("jobName");
     String jobGroup = ServletActionContext.getRequest().getParameter("jobGroup");
     HessianResult result = this.qrtzTriggersService.removeTrigger(jobName, jobGroup);
     if (!result.getCode().equals("0")) {
       throw new ServiceException(result.getMessage());
     }
   } catch (Exception e) {
     validateInfo.setSuccess(false);
     validateInfo.setMsg(e.getLocalizedMessage());
     e.printStackTrace();
   }
   return "reload";
 }
 /**
  * 改变数量
  *
  * @throws IOException
  */
 public void addCount() throws IOException {
   count = Integer.parseInt(ServletActionContext.getRequest().getParameter("count"));
   id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id"));
   GoodStore goodStore = goodStoreService.getGoodsStore(id);
   goodStore.setCount(count);
   try {
     goodStoreService.saveOrUpdate(goodStore);
     m.put("msg", "1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   } catch (Exception e) {
     e.printStackTrace();
     m.put("msg", "-1");
     ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m));
   }
 }
 /**
  * 将错误加入错误列表session
  *
  * @param error
  */
 public AppException(String error) {
   HttpSession session = ServletActionContext.getRequest().getSession();
   /** 设置传参时编码格式 */
   try {
     ServletActionContext.getRequest().setCharacterEncoding("UTF-8");
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   }
   ArrayList<String> errorlist = new ArrayList<String>();
   if (session.getAttribute("errorlist") != null) {
     errorlist = (ArrayList<String>) session.getAttribute("errorlist");
   }
   errorlist.add(error);
   session.setAttribute("errorlist", errorlist);
 }