Example usage for javax.servlet.jsp JspWriter print

List of usage examples for javax.servlet.jsp JspWriter print

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter print.

Prototype


abstract public void print(Object obj) throws IOException;

Source Link

Document

Print an object.

Usage

From source file:com.ultrapower.eoms.common.plugin.ecside.tag.form.ECSideFormTag.java

 @Override
public int doAfterBody() {
   BodyContent body = getBodyContent();/*from  w ww  .  j a  v  a 2 s.com*/
   try    {
      JspWriter out = body.getEnclosingWriter();
      String bodytext = body.getString();
      if ((beansValues != null) && (beansValues.size() > 0)) {
         bodytext = populateForm(bodytext, beansValues);
      }
      out.print(bodytext);
   } catch (Exception ex) {
      LogHandler.errorLog(logger, ex);
   }
   return SKIP_BODY;
}

From source file:com.googlecode.jtiger.modules.ecside.tag.form.ECSideFormTag.java

public int doAfterBody() {
    BodyContent body = getBodyContent();
    try {/*from   w w w  .  java 2s.c o m*/
        JspWriter out = body.getEnclosingWriter();
        String bodytext = body.getString();
        if ((beansValues != null) && (beansValues.size() > 0)) {
            bodytext = populateForm(bodytext, beansValues);
        }
        out.print(bodytext);
    } catch (Exception ex) {
        LogHandler.errorLog(logger, ex);
    }
    return SKIP_BODY;
}

From source file:org.kuali.mobility.tags.LocalisedFieldTag.java

/**
 * Writes the buttons with supported languages
 *
 * @param languages//from  w w  w  .ja  va2s  .c o  m
 * @throws IOException
 */
private void writeLanguageOptions(JspWriter out, List<String> languages) throws IOException {
    for (String language : languages) {
        // <a data-l10n-lang="EN" href="javascript:;" >EN</a> 
        out.print("<a data-l10n-lang=\"");
        out.print(language);
        out.print("\" href=\"javascript:;\"");

        // If it is the active language, add the active style
        if (getDefaultLanguage().equals(language)) {
            out.print(" class=\"l10n-active\"");
        }

        out.print(">");
        out.print(language.toUpperCase());
        out.println("</a>");
    }
}

From source file:jp.terasoluna.fw.web.struts.taglib.BodyTag.java

/**
 * ^O]?I?\bh?B//  w  ww  . j  av a  2s.co m
 *
 * @return ???w?B? <code>EVAL_PAGE</code>
 * @throws JspException JSPO
 */
@Override
public int doEndTag() throws JspException {
    try {
        JspWriter out = pageContext.getOut();
        out.print("</body>");
    } catch (IOException e) {
        log.error("Output failed");
        throw new JspTagException(e.toString());
    }

    return EVAL_PAGE;
}

From source file:com.xhsoft.framework.common.page.WebappPageTag.java

/**
 * <p>Description: ?</p>/*from w ww  .  j ava  2s  .c  o  m*/
 * @return void
 * @author wenzhi
 * @version 1.0
 * @exception JspException
 */
private void printOutEnd() throws JspException {
    try {
        JspWriter out = pageContext.getOut();
        String outString = "";
        out.print(outString);
    } catch (Exception e) {
        throw new JspException(e);
    }
}

From source file:cn.vlabs.duckling.vwb.tags.LinkTag.java

public int doEndTag() {
    try {//ww w .ja  v a2  s  .c o  m
        if (!m_overrideAbsolute) {
            m_absolute = false;
        }

        JspWriter out = pageContext.getOut();
        String url = figureOutURL();

        switch (m_format) {
        case URL:
            out.print(url);
            break;
        default:
        case ANCHOR:
            StringBuffer sb = new StringBuffer(20);

            sb.append((m_class != null) ? "class=\"" + m_class + "\" " : "");
            sb.append((m_style != null) ? "style=\"" + m_style + "\" " : "");
            sb.append((m_target != null) ? "target=\"" + m_target + "\" " : "");
            sb.append((m_title != null) ? "title=\"" + m_title + "\" " : "");
            sb.append((m_rel != null) ? "rel=\"" + m_rel + "\" " : "");
            sb.append((m_accesskey != null) ? "accesskey=\"" + m_accesskey + "\" " : "");
            out.print("<a " + sb.toString() + " href=\"" + url + "\">");
            break;
        }

        // Add any explicit body content. This is not the intended use
        // of LinkTag, but happens to be the way it has worked previously.
        if (m_bodyContent != null) {
            String linktext = m_bodyContent.getString().trim();
            out.write(linktext);
        }

        // Finish off by closing opened anchor
        if (m_format == ANCHOR)
            out.print("</a>");
    } catch (Exception e) {
        // Yes, we want to catch all exceptions here, including
        // RuntimeExceptions
        log.error("Tag failed", e);
    }

    return EVAL_PAGE;
}

From source file:com.xhsoft.framework.common.page.MiniPageTag.java

/**
 * <p>Description:print info to jsp page</p>
 * @param request   /*  w  w w.j  av  a2s  .co  m*/
 * @param mothod 
 * @param page   
 * @return void
 * @author wenzhi
 * @version 1.0
 * @exception JspException
 */
private void printOutPages(HttpServletRequest request, String mothod, String page) throws JspException {
    if (mothod.endsWith("now")) {
        try {
            JspWriter out = pageContext.getOut();
            String outString = "&nbsp;<span><font class='currentNum'>[" + page + "]</font></span>";
            out.print(outString);
        } catch (Exception e) {
            throw new JspException(e);
        }
    } else {
        try {
            JspWriter out = pageContext.getOut();
            String outString = "&nbsp;" + "<a href=\"javascript:setPage('" + page + "','" + targets + "');\">"
                    + "" + page + "</a>";
            out.print(outString);
        } catch (Exception e) {
            throw new JspException(e);
        }
    }
}

From source file:oscar.oscarMessenger.config.data.MsgMessengerGroupData.java

@SuppressWarnings("unchecked")
public void printAllProvidersWithMembers(Locale locale, String grpNo, JspWriter out) {
    java.util.Vector<String> vector = membersInGroups(grpNo);
    ProviderDao dao = SpringUtils.getBean(ProviderDao.class);
    List<Provider> ps = dao.getProviders();
    Collections.sort(ps, new BeanComparator("lastName"));
    try {//  w  w w .j  a  v a  2  s  .  c  om
        for (Provider p : ps) {
            out.print("   <tr>");
            out.print("      <td>");
            if (vector.contains(p.getProviderNo())) {
                out.print("<input type=\"checkbox\" name=providers value=" + p.getProviderNo() + " checked >");
            } else {
                out.print("<input type=\"checkbox\" name=providers value=" + p.getProviderNo() + ">");
            }
            out.print("      </td>");
            out.print("      <td>");
            out.print(p.getLastName());
            out.print("      </td>");
            out.print("      <td>");
            out.print(p.getFirstName());
            out.print("      </td>");
            out.print("      <td>");

            String strProviderType = p.getProviderType();

            out.print(strProviderType);

            out.print("      </td>");

            out.print("   </tr>");
        }
    } catch (Exception e) {
        MiscUtils.getLogger().error("Error", e);
    }

}

From source file:com.xhsoft.framework.common.page.WebappPageTag.java

/**
 * <p>Description: </p>//from  www.ja  v  a2s . co m
 * @return int
 * @author wenzhi
 * @version 1.0
 * @exception JspException
 */
@SuppressWarnings("unchecked")
@Override
public int doStartTag() throws JspException {
    /**?request*/
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    Page page = (Page) request.getAttribute("page");

    String pageURL = (String) request.getAttribute("pageURL");
    if (pageURL.indexOf("?") != -1) {
        link = pageURL + "&";
    } else {
        link = pageURL + "?";
    }
    if (link.indexOf("qm.pn") != -1) {
        link = link.substring(0, link.indexOf("qm.pn"));
    }

    /** request??????Actionrequest*/
    int pageNo = page.getPageNo();
    @SuppressWarnings("unused")
    int limit = page.getLimit();
    int totalPages = page.getTotalPages();
    JspWriter out = pageContext.getOut();

    try {
        out.print("<div class=\"np\">");
        printOutFront(pageNo, request);
        printOutBack(pageNo, totalPages, request);
        printOutEnd();
        @SuppressWarnings("unused")
        int pn = 0;
        if (pageNo > 0 && totalPages > 0) {
            pn = pageNo;
        }
        @SuppressWarnings("unused")
        int start = 0;
        if (pageNo > 0 && totalPages > 0) {
            start = page.getOffset() + 1;
        }
        out.print("" + totalPages + "</div>");
    } catch (IOException e) {
        e.printStackTrace();
    }

    return EVAL_PAGE;
}

From source file:com.xhsoft.framework.common.page.PageTag.java

/**
 * <p>Description:</p>//from  w  w w  .j  av  a  2s . c  om
 * @return int
 * @author wenzhi
 * @version 1.0
 * @exception Exception
 */
@SuppressWarnings("unchecked")
public int doStartTag() throws JspException {
    /** ?request*/
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    Page page = (Page) request.getAttribute("page");

    /** request??????Actionrequest*/
    int pageNo = page.getPageNo();
    int limit = page.getLimit();
    int totalPages = page.getTotalPages();

    JspWriter out = pageContext.getOut();
    try {
        out.print("<table id=\"page-table\" cellspacing=\"0\">");
        out.print("<tbody>");
        out.print("<tr>");
        out.print("<td style=\"background-color: rgb(255, 255, 255);\" align=\"left\">");
        out.print("<div id=\"turn-page\">");
        out.print("<span id=\"page-link\">");
        printOutFront(pageNo, request);
        buildPager(request, pageNo, totalPages);
        printOutBack(pageNo, totalPages, request);
        buildGoto(request, pageNo, totalPages);
        printOutEnd();
        out.print("</span></div>");
        out.print("</td>");
        out.print("<td align=\"right\" style=\"padding-right:1em;\">");
        buildSelecter(request, limit);
        int pn = 0;
        if (pageNo > 0 && totalPages > 0) {
            pn = pageNo;
        }

        int start = 0;
        if (pageNo > 0 && totalPages > 0) {
            start = page.getOffset() + 1;
        }
        out.print("" + pn + "/" + page.getTotalPages() + "(" + start + "-" + page.getEndIndex()
                + " of " + page.getTotalRows() + ")");
        out.print(" </td></tr></tbody></table>");
        out.print("<script type=\"text/javascript\">");
        String pageURL = (String) request.getAttribute("pageURL");
        out.print("dojo.widget.byId(\"" + targets + "\").href = '" + pageURL + "';");
        out.print("</script>");
    } catch (IOException e) {
        e.printStackTrace();
    }

    return EVAL_PAGE;
}