Example #1
0
  @CsrfProtect
  public void ajaxCheque(
      ActionMapping map,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    List<TermsKeyName> tknList = null;

    String orgCode = request.getSession().getAttribute("orgCode").toString();

    if ("".equals(request.getParameter("termsKeyNameId"))) {

      tknList =
          tknBo.hqlQuery(
              "from TermsKeyName t where t.deleteFlag = 'N' and t.orgCode = "
                  + orgCode
                  + " and lower(t.termsKeyName) = '"
                  + request.getParameter("termsKeyName").toLowerCase()
                  + "'");

    } else {

      TermsKeyName tkn =
          (TermsKeyName)
              tknBo.load(TermsKeyName.class, Long.valueOf(request.getParameter("termsKeyNameId")));

      tknList =
          tknBo.hqlQuery(
              "from TermsKeyName t where t.deleteFlag = 'N' and t.orgCode = "
                  + orgCode
                  + " and t.termsKeyNameId != "
                  + tkn.getTermsKeyNameId()
                  + " and lower(t.termsKeyName) = '"
                  + request.getParameter("termsKeyName").toLowerCase()
                  + "'");
    }

    String isValid = "true";

    if (tknList.size() > 0) {
      isValid = "false";
    }

    try {

      response.setCharacterEncoding("UTF-8");
      response.getWriter().write("{\"success\":\"" + isValid + "\"}");
      response.getWriter().flush();

    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #2
0
  @CsrfProtect
  public String query(
      ActionMapping map,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    TermsKeyName f = (TermsKeyName) form;

    f.setOrgCode(Long.valueOf(request.getSession().getAttribute("orgCode").toString()));

    Map resultMap = tknBo.query(f);

    request.setAttribute("count", resultMap.get("count"));

    request.setAttribute("resultList", resultMap.get("resultList"));

    return "termsKeyNameQuery";
  }