当前位置: 首页>>代码示例>>Java>>正文


Java TagUtils.getInstance方法代码示例

本文整理汇总了Java中org.apache.struts.taglib.TagUtils.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java TagUtils.getInstance方法的具体用法?Java TagUtils.getInstance怎么用?Java TagUtils.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.struts.taglib.TagUtils的用法示例。


在下文中一共展示了TagUtils.getInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doStartTag

import org.apache.struts.taglib.TagUtils; //导入方法依赖的package包/类
/**
 * Generate the required input tag.
 * <p>
 * Support for indexed property since Struts 1.1
 * 
 * @exception JspException
 *                if a JSP exception has occurred
 */
public int doStartTag() throws JspException {
	TagUtils tagUtils = TagUtils.getInstance();
	if (isAllowEdits()) {
		return super.doStartTag();
	} else {
		// Look up the requested property value
		Object value =
		// RequestUtils.lookup(pageContext, name, property, null);
		tagUtils.lookup(pageContext, name, property, null);

		if (value == null)
			return (SKIP_BODY); // Nothing to output
		String output = value.toString();
		if (getStyleClass() != null) {
			output = "<span class=" + getStyleClass() + ">" + output
					+ "</span>";
		}
		output = output + "\r\n" + "<INPUT type=\"hidden\"  name=\""
				+ getProperty() + "\"" + " value=\"" + value.toString()
				+ "\"" + ">";
		// ResponseUtils.write(pageContext, output);
		tagUtils.write(pageContext, output);
	}
	return (EVAL_BODY_BUFFERED);
}
 
开发者ID:openelisglobal,项目名称:openelisglobal-sandbox,代码行数:34,代码来源:TextTag.java

示例2: renderButton

import org.apache.struts.taglib.TagUtils; //导入方法依赖的package包/类
/**
 * Renders a button control as a hyperlink for the page control.
 *
 * @param  render    Whether or not to render the control.
 * @param  page      The page number that the control links to.
 * @param  index     The page secondary index that the control links to.
 * @param  openDelim The opening delimeter to put around the control. (A snippet of HTML).
 * @param  url       The url of the page action handler.
 * @param  text      The text to render the control.
 * @param  active    Whether or not the control should be made active.
 *
 * @throws JspException If an error occurs whilst writing out the response.
 */
private void renderButton(boolean render, int page, int index, String openDelim, String url, String text,
    boolean active) throws JspException
{
    log.fine(
        "private void renderButton(boolean render, int page, int index, String openDelim, String url, String text, boolean active): called");
    log.fine("render = " + render);
    log.fine("page = " + page);
    log.fine("index = " + index);
    log.fine("openDelim = " + openDelim);
    log.fine("url = " + url);
    log.fine("text = " + text);
    log.fine("active = " + active);

    TagUtils tagUtils = TagUtils.getInstance();

    if (render)
    {
        tagUtils.write(pageContext, openDelim);

        // Only render the button as active if the active flag is set.
        if (active)
        {
            tagUtils.write(pageContext,
                "<a href=\"" + url + "?varName=" + name + "&number=" + page + "&index=" + index + "\">" + text +
                "</a>");
        }

        // Render an inactive button.
        else
        {
            tagUtils.write(pageContext, text);
        }

        tagUtils.write(pageContext, closeDelim);
    }
}
 
开发者ID:rupertlssmith,项目名称:lojix,代码行数:50,代码来源:PageControlTag.java

示例3: doStartTag

import org.apache.struts.taglib.TagUtils; //导入方法依赖的package包/类
/**
   * Render the beginning of this select tag.
   * <p>
   * Support for indexed property since Struts 1.1
   *
   * @exception JspException if a JSP exception has occurred
   */
  public int doStartTag() throws JspException {

TagUtils tagUtils = TagUtils.getInstance();
if (isAllowEdits()) {
	return super.doStartTag();
} else {
          setDisabled(true);
	return super.doStartTag();
}
  }
 
开发者ID:openelisglobal,项目名称:openelisglobal-sandbox,代码行数:18,代码来源:SelectTag.java

示例4: doStartTag

import org.apache.struts.taglib.TagUtils; //导入方法依赖的package包/类
/**
   * Render the beginning of this select tag.
   * <p>
   * Support for indexed property since Struts 1.1
   *
   * @exception JspException if a JSP exception has occurred
   */
  public int doStartTag() throws JspException {

TagUtils tagUtils = TagUtils.getInstance();
if (isAllowEdits()) {
	return super.doStartTag();
} else {
	// Look up the requested property value
	Object value =
	// RequestUtils.lookup(pageContext, name, property, null);
	tagUtils.lookup(pageContext, name, property, null);

	if (value == null)
		return (SKIP_BODY); // Nothing to output
	String output = value.toString();
	if (getStyleClass() != null) {
		output = "<span class=" + getStyleClass() + ">" + output
				+ "</span>";
	}
	output = output + "\r\n" + "<INPUT type=\"hidden\"  name=\""
			+ getProperty() + "\"" + " value=\"" + value.toString()
			+ "\"" + ">";
	// ResponseUtils.write(pageContext, output);
	tagUtils.write(pageContext, output);
}
return (EVAL_BODY_BUFFERED);
  }
 
开发者ID:openelisglobal,项目名称:openelisglobal-sandbox,代码行数:34,代码来源:TextareaTag.java

示例5: doStartTag

import org.apache.struts.taglib.TagUtils; //导入方法依赖的package包/类
/**
 * Renders the paging control.
 *
 * @return Always SKIP_BODY;
 *
 * @throws JspException If the named paged list variable cannot be found.
 */
public int doStartTag() throws JspException
{
    log.fine("public int doStartTag(): called");

    TagUtils tagUtils = TagUtils.getInstance();

    // Get a reference to the PagedList.
    PagedList list = (PagedList) tagUtils.lookup(pageContext, name, property, scope);
    log.fine("list = " + list);

    // Work out what the URL of the action to handle the paging events is.
    String url;

    try
    {
        url = tagUtils.computeURL(pageContext, null, null, null, action, null, null, null, false);
    }
    catch (MalformedURLException e)
    {
        throw new JspException("Got malformed URL exception: ", e);
    }

    // Optionally render the first page button.
    renderButton(renderFirst, 0, 0, openDelimFirst, url, firstText, list.getCurrentPage() != 0);

    // Optionally render the back button.
    renderButton(renderBack, list.getCurrentPage() - 1,
        ((list.getCurrentPage() - 1) < list.getCurrentIndex()) ? (list.getCurrentIndex() - maxPages)
                                                               : list.getCurrentIndex(), openDelimBack, url,
        backText, (list.getCurrentPage() - 1) >= 0);

    // Render links for pages from the current index to the current index plus the maximum number of pages.
    int from = list.getCurrentIndex();
    int to = list.getCurrentIndex() + maxPages;

    for (int i = from; (i < list.size()) && (i < to); i++)
    {
        renderButton(true, i, list.getCurrentIndex(),
            (i == list.getCurrentPage()) ? openDelimCurrent : openDelimNumber, url, "" + (i + 1),
            i != list.getCurrentPage());
    }

    // Optionally render a more button. The more button should only be rendered if the current index plus
    // the maximum number of pages is less than the total number of pages so there are pages beyond those that
    // have numeric link to them already.
    renderButton((list.getCurrentIndex() + maxPages) < list.size(), list.getCurrentPage() + maxPages,
        list.getCurrentPage() + maxPages, openDelimMore, url, moreText, true);

    // Optionally render a forward button.
    renderButton(renderForward, list.getCurrentPage() + 1,
        ((list.getCurrentPage() + 1) >= (list.getCurrentIndex() + maxPages)) ? (list.getCurrentIndex() + maxPages)
                                                                             : list.getCurrentIndex(),
        openDelimForward, url, forwardText, (list.getCurrentPage() + 1) < list.size());

    // Optionally render a last page button.
    renderButton(renderLast, list.size() - 1, (list.size() / maxPages) * maxPages, openDelimLast, url, lastText,
        list.getCurrentPage() != (list.size() - 1));

    return SKIP_BODY;
}
 
开发者ID:rupertlssmith,项目名称:lojix,代码行数:68,代码来源:PageControlTag.java


注:本文中的org.apache.struts.taglib.TagUtils.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。