code: private void printElementErrorTag(String elementSitePath, String formatterSitePath, Exception exception)
      throws IOException {
  
          if (m_editableRequest) {
              String stacktrace = CmsException.getStackTraceAsString(exception);
              if (CmsStringUtil.isEmptyOrWhitespaceOnly(stacktrace)) {
                  stacktrace = null;
              } else {
                  // stacktrace = CmsStringUtil.escapeJavaScript(stacktrace);
                  stacktrace = CmsEncoder.escapeXml(stacktrace);
              }
              StringBuffer errorBox = new StringBuffer(256);
              errorBox.append(
                  "<div style=\"display:block; padding: 5px; border: red solid 2px; color: black; background: white;\" class=\"");
              errorBox.append(CmsContainerElement.CLASS_ELEMENT_ERROR);
              errorBox.append("\">");
              errorBox.append(
                  Messages.get().getBundle().key(
                      Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
                      elementSitePath,
                      formatterSitePath));
              errorBox.append("<br />");
              errorBox.append(exception.getLocalizedMessage());
              if (stacktrace != null) {
                  errorBox.append(
                      "<span onclick=\"opencms.openStacktraceDialog(event);\" style=\"border: 1px solid black; cursor: pointer;\">");
                  errorBox.append(Messages.get().getBundle().key(Messages.GUI_LABEL_STACKTRACE_0));
                  String title = Messages.get().getBundle().key(
                      Messages.ERR_CONTAINER_PAGE_ELEMENT_RENDER_ERROR_2,
                      elementSitePath,
                      formatterSitePath);
                  errorBox.append("<span title=\"");
                  errorBox.append(CmsEncoder.escapeXml(title));
                  errorBox.append("\" class=\"hiddenStacktrace\" style=\"display:none;\">");
                  errorBox.append(stacktrace);
                  errorBox.append("</span></span>");
              }
              errorBox.append("</div>");
              pageContext.getOut().print(errorBox.toString());
          }
      }
docs: Prints an element error tag to the response out.<p>
  
  @param elementSitePath the element site path
  @param formatterSitePath the formatter site path
  @param exception the exception causing the error
  
  @throws IOException if something goes wrong writing to response out