Пример #1
0
  public ActionForward create(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    ComplainForm cForm = (ComplainForm) form;

    if (cForm.getContent() == null || cForm.getContent().trim().length() < 1) {
      request.setAttribute("errMsg", "请输入投诉内容!");
      return mapping.findForward("error");
    }

    try {
      Userinfo info = getUser(request.getSession());
      Long uid = 0l;
      if (info != null) uid = info.getId();

      Complain city = getLogic().create(cForm, uid);
      request.setAttribute("errMsg", "投诉成功!");
      //			request.setAttribute("backUrl", "city.do?method=list");
      request
          .getRequestDispatcher("/feedback.jsp?id=" + request.getParameter("infoId"))
          .forward(request, response);
      return null;
    } catch (Exception e) {
      e.printStackTrace();
      request.setAttribute("errMsg", e.getMessage());
      return mapping.findForward("error");
    }

    //		return mapping.findForward("success");
  }
Пример #2
0
 public boolean equals(Object other) {
   if (!(other instanceof Userinfo)) return false;
   Userinfo castOther = (Userinfo) other;
   return new EqualsBuilder().append(this.getId(), castOther.getId()).isEquals();
 }