示例#1
0
  public static void makeHiddenFormLinkAnchor(
      Appendable writer,
      String linkStyle,
      String description,
      String confirmation,
      ModelFormField modelFormField,
      HttpServletRequest request,
      HttpServletResponse response,
      Map<String, Object> context)
      throws IOException {
    if (UtilValidate.isNotEmpty(description)
        || UtilValidate.isNotEmpty(request.getAttribute("image"))) {
      writer.append("<a");

      if (UtilValidate.isNotEmpty(linkStyle)) {
        writer.append(" class=\"");
        writer.append(linkStyle);
        writer.append("\"");
      }

      writer.append(" href=\"javascript:document.");
      writer.append(makeLinkHiddenFormName(context, modelFormField));
      writer.append(".submit()\"");

      if (UtilValidate.isNotEmpty(modelFormField.getEvent())
          && UtilValidate.isNotEmpty(modelFormField.getAction(context))) {
        writer.append(" ");
        writer.append(modelFormField.getEvent());
        writer.append("=\"");
        writer.append(modelFormField.getAction(context));
        writer.append('"');
      }

      if (UtilValidate.isNotEmpty(confirmation)) {
        writer.append(" onclick=\"return confirm('");
        writer.append(confirmation);
        writer.append("')\"");
      }

      writer.append('>');

      if (UtilValidate.isNotEmpty(request.getAttribute("image"))) {
        writer.append("<img src=\"");
        writer.append(request.getAttribute("image").toString());
        writer.append("\"/>");
      }

      writer.append(description);
      writer.append("</a>");
    }
  }
示例#2
0
  public static void makeHyperlinkString(
      Appendable writer,
      String linkStyle,
      String targetType,
      String target,
      Map<String, String> parameterMap,
      String description,
      String confirmation,
      ModelFormField modelFormField,
      HttpServletRequest request,
      HttpServletResponse response,
      Map<String, Object> context,
      String targetWindow)
      throws IOException {
    if (UtilValidate.isNotEmpty(description)
        || UtilValidate.isNotEmpty(request.getAttribute("image"))) {
      writer.append("<a");

      if (UtilValidate.isNotEmpty(linkStyle)) {
        writer.append(" class=\"");
        writer.append(linkStyle);
        writer.append("\"");
      }

      writer.append(" href=\"");

      buildHyperlinkUrl(
          writer,
          target,
          targetType,
          parameterMap,
          null,
          false,
          false,
          true,
          request,
          response,
          context);

      writer.append("\"");

      if (UtilValidate.isNotEmpty(targetWindow)) {
        writer.append(" target=\"");
        writer.append(targetWindow);
        writer.append("\"");
      }

      if (UtilValidate.isNotEmpty(modelFormField.getEvent())
          && UtilValidate.isNotEmpty(modelFormField.getAction(context))) {
        writer.append(" ");
        writer.append(modelFormField.getEvent());
        writer.append("=\"");
        writer.append(modelFormField.getAction(context));
        writer.append('"');
      }
      if (UtilValidate.isNotEmpty(confirmation)) {
        writer.append(" onclick=\"return confirm('");
        writer.append(confirmation);
        writer.append("')\"");
      }
      writer.append('>');

      if (UtilValidate.isNotEmpty(request.getAttribute("image"))) {
        writer.append("<img src=\"");
        writer.append(request.getAttribute("image").toString());
        writer.append("\"/>");
      }

      writer.append(description);
      writer.append("</a>");
    }
  }