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


Java BodyTagSupport类代码示例

本文整理汇总了Java中javax.servlet.jsp.tagext.BodyTagSupport的典型用法代码示例。如果您正苦于以下问题:Java BodyTagSupport类的具体用法?Java BodyTagSupport怎么用?Java BodyTagSupport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doStartTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
@Override
public int doStartTag() throws JspException {
    // 在标签开始处出发该方法
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    SSOToken token = SSOHelper.getSSOToken(request);
    // 如果 token 或者 name 为空
    if (token != null && this.getName() != null && !"".equals(this.getName().trim())) {
        boolean result = SSOConfig.getInstance().getAuthorization().isPermitted(token, this.getName());
        if (result) {
            // 权限验证通过
            // 返回此则执行标签body中内容,SKIP_BODY则不执行
            return BodyTagSupport.EVAL_BODY_INCLUDE;
        }
    }
    return BodyTagSupport.SKIP_BODY;
}
 
开发者ID:baomidou,项目名称:kisso,代码行数:17,代码来源:HasPermissionTag.java

示例2: doStartTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * Write a configuration property indicated in the tag id
 */
public int doStartTag()
   throws JspException
{
	try
	{
		String propName = this.getId();
		
		Debugger.println(this,"looking for config property id "+propName);
		
		this.pageContext.getOut().write(Config.getProperty(this.getId(),defaultValue));			
	} 
	catch (IOException e)
	{			
		Debugger.printError(e);

	}
	return BodyTagSupport.SKIP_BODY;
}
 
开发者ID:nyla-solutions,项目名称:nyla,代码行数:22,代码来源:ConfigTag.java

示例3: doEndTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public int doEndTag() throws JspException {
    StringBuilder result = new StringBuilder();
    if (nolink || id == null) {
        result.append(writeIcon());
        result.append(name);
    }
    else {
        result.append("<a href=\"" +
                    ConfigChannelTag.makeConfigChannelUrl(id) + "\">");
        result.append(writeIcon());
        result.append(StringEscapeUtils.escapeXml(name) + "</a>");
    }
    JspWriter writer = pageContext.getOut();
    try {
        writer.write(result.toString());
    }
    catch (IOException e) {
        throw new JspException(e);
    }
    return BodyTagSupport.SKIP_BODY;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:25,代码来源:ConfigChannelTag.java

示例4: doEndTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * ${@inheritDoc}
 */
public int doEndTag() throws JspException {
    if (sortable && attributeName == null && sortAttribute == null) {
        throw new JspException("Sortable columns must use either attr or sortAttr");
    }
    checkForBoundsAndAttrs();
    ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
    if (command.equals(ListCommand.RENDER)) {
        ListTagUtil.write(pageContext, "</td>");
    }
    else if (command.equals(ListCommand.ENUMERATE) &&
                        !StringUtils.isBlank(filterAttr)) {
        setupColumnFilter();
    }

    return BodyTagSupport.EVAL_PAGE;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:20,代码来源:ColumnTag.java

示例5: doStartTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int doStartTag() throws JspException {

    ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
    ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
            ListTag.class);
    listName = parent.getUniqueName();
    int retval = BodyTagSupport.SKIP_BODY;
    setupRhnSet();
    if (command.equals(ListCommand.ENUMERATE)) {
        parent.addColumn();
        retval = BodyTagSupport.EVAL_PAGE;
    }
    else if (command.equals(ListCommand.COL_HEADER)) {
        renderHeader(parent);
        retval = BodyTagSupport.EVAL_PAGE;
    }
    else if (command.equals(ListCommand.RENDER)) {
        renderCheckbox();
    }
    return retval;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:26,代码来源:SelectableColumnTag.java

示例6: getOnClickScript

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * renders
 * //onclick="checkbox_clicked(this, '$rhnSet')"
 *
 */
private String getOnClickScript(String funcName, String boxName) {
    Object current = getCurrent();
    Object parent = getParentObject();
    String childIds = "[]";
    String memberIds = "[]";
    String parentId = "";
    ListTag parentTag = (ListTag)
        BodyTagSupport.findAncestorWithClass(this, ListTag.class);

    if (RhnListTagFunctions.isExpandable(current)) {
        childIds = getChildIds(current);
    }
    else {
        parentId = getParentId(current, parent);
        memberIds = getMemberIds(current, parent);
    }

    return String.format(CHECKBOX_CLICKED_SCRIPT, funcName, boxName,
                        rhnSet,  makeSelectAllCheckboxId(listName),
                        childIds, memberIds, parentId,
                        parentTag.isParentAnElement());

}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:29,代码来源:SelectableColumnTag.java

示例7: renderHiddenItem

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
private void renderHiddenItem(String listId, String value) throws JspException {
    ListTagUtil.write(pageContext, "<input type=\"hidden\" ");
    ListTagUtil.write(pageContext, "id=\"");
    ListTagUtil.write(pageContext, "list_items_" + listName + "_" + listId);
    String pageItems = ListTagUtil.makePageItemsName(listName);
    ListTag parent = (ListTag)
                BodyTagSupport.findAncestorWithClass(this, ListTag.class);
    if (!parent.isParentAnElement() &&
            RhnListTagFunctions.isExpandable(getCurrent())) {
        pageItems = "parent_" + pageItems;
    }
    ListTagUtil.write(pageContext, "\" name=\"" + pageItems + "\" ");
    ListTagUtil.write(pageContext, "value=\"");
    ListTagUtil.write(pageContext, value);
    ListTagUtil.write(pageContext, "\" />\n");
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:17,代码来源:SelectableColumnTag.java

示例8: getIgnorableParentIds

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
private String getIgnorableParentIds() {
    ListTag parent = (ListTag)
            BodyTagSupport.findAncestorWithClass(this, ListTag.class);
    if (!parent.isParentAnElement()) {
        StringBuilder buf = new StringBuilder();
        for (Object current : parent.getPageData()) {
            if (RhnListTagFunctions.isExpandable(current)) {
                if (buf.length() > 0) {
                    buf.append(",");
                }
                buf.append("'");
                buf.append(makeCheckboxId(listName,
                                    ListTagHelper.getObjectId(current)));
                buf.append("'");
            }
        }
        buf.insert(0, "[");
        buf.append("]");
        return buf.toString();
    }
    return "[]";
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:23,代码来源:SelectableColumnTag.java

示例9: getDecorator

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
private ListDecorator getDecorator(String decName) throws JspException {
    if (decName != null) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        try {
            if (decName.indexOf('.') == -1) {
                decName = "com.redhat.rhn.frontend.taglibs.list.decorators." +
                                                        decName;
            }
            ListDecorator dec = (ListDecorator) cl.loadClass(decName)
                    .newInstance();
            ListSetTag parent = (ListSetTag) BodyTagSupport
                    .findAncestorWithClass(this, ListSetTag.class);
            dec.setEnvironment(pageContext, parent, getUniqueName());
            return dec;
        }
        catch (Exception e) {
            String msg = "Exception while adding Decorator [" + decName + "]";
            throw new JspException(msg, e);
        }
    }
    return null;

}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:24,代码来源:ListTag.java

示例10: doEndTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * ${@inheritDoc}
 */
@Override
public int doEndTag() throws JspException {
    // print the hidden fields after the list widget is printed
    // but before the form of the listset is closed.
    ListTagUtil.write(pageContext, String.format(HIDDEN_TEXT,
            ListTagUtil.makeParentIsAnElementLabel(getUniqueName()),
            parentIsElement));

    // here decorators should insert other e.g hidden input fields
    for (ListDecorator dec : getDecorators()) {
        dec.afterList();
    }

    ListTagUtil.write(pageContext, "<!-- END " + getUniqueName() + " -->");
    release();
    return BodyTagSupport.EVAL_PAGE;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:21,代码来源:ListTag.java

示例11: doAfterBodyRenderBeforeData

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
private int doAfterBodyRenderBeforeData() throws JspException {
    ListTagUtil.write(pageContext, "</tr>");
    ListTagUtil.write(pageContext, "</thead>");

    ListTagUtil.setCurrentCommand(pageContext, getUniqueName(),
            ListCommand.BEFORE_RENDER);

    if (manip.isListEmpty()) {
        renderEmptyList();
        ListTagUtil.write(pageContext, "</table>");
        // close panel
        ListTagUtil.write(pageContext, "</div>");
        // close list
        ListTagUtil.write(pageContext, "</div>");

        return BodyTagSupport.SKIP_BODY;
    }
    ListTagUtil.write(pageContext, "<tbody>");

    // render first row. The rest will be rendered in subsequent
    // calls to doAfterBody
    return doAfterBodyRenderData();
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:24,代码来源:ListTag.java

示例12: doAfterBody

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * ${@inheritDoc}
 */
@Override
public int doAfterBody() throws JspException {
    int retval = BodyTagSupport.EVAL_BODY_AGAIN;

    ListCommand nextCmd = getNextCommand();

    switch (nextCmd) {
        case TBL_HEADING:    doAfterBodyRenderListBegin(); break;
        case TBL_ADDONS:     doAfterBodyRenderTopAddons(); break;
        case COL_HEADER:     doAfterBodyRenderColHeaders(); break;
        case BEFORE_RENDER:  retval = doAfterBodyRenderBeforeData(); break;
        case RENDER:         retval = doAfterBodyRenderData(); break;
        case AFTER_RENDER:   retval = doAfterBodyRenderAfterData(); break;
        case TBL_FOOTER:     retval = doAfterBodyRenderFooterAddons(); break;
        default: break;
    }
    return retval;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:22,代码来源:ListTag.java

示例13: doStartTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public int doStartTag() throws JspException {

    ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext);
    ListTag parent = (ListTag) BodyTagSupport.findAncestorWithClass(this,
            ListTag.class);
    listName = parent.getUniqueName();
    int retval = BodyTagSupport.SKIP_BODY;

    if (command.equals(ListCommand.ENUMERATE)) {
        parent.addColumn();
        renderHiddenField();
        retval = BodyTagSupport.EVAL_PAGE;
    }
    else if (command.equals(ListCommand.COL_HEADER)) {
        renderHeader(parent);
        retval = BodyTagSupport.EVAL_PAGE;
    }
    else if (command.equals(ListCommand.RENDER)) {
        render(valueExpr);
    }
    return retval;
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:27,代码来源:RadioColumnTag.java

示例14: doEndTag

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
@Override
public int doEndTag() throws JspException
{
   try
   {
      BodyContent bc = this.getBodyContent();
      String body = bc.getString();
      JspWriter out = this.pageContext.getOut();
      out.println("<body>");
      out.print(body);

      JSONStructure jsonStructure = new JSONStructure(0);
      this.marshaller.marschall(this.serializationData, jsonStructure);
      String json = jsonStructure.toString();

      out.println("<script>\nvar bz_davide_dm_widgets = " + json + "</script>");
      out.println("</body>");
      return BodyTagSupport.EVAL_PAGE;
   }
   catch (Exception exxx)
   {
      throw new JspException(exxx);
   }
}
 
开发者ID:davidebz,项目名称:DMWeb,代码行数:25,代码来源:DMWebFragmentBodyTagLibrary.java

示例15: testDoStartTag_null_key

import javax.servlet.jsp.tagext.BodyTagSupport; //导入依赖的package包/类
/**
 * Key is null, check that we return EVAL_BODY_INCLUDE.
 * 
 * @throws JspException
 */
@Test
public void testDoStartTag_null_key() throws JspException {
	// given
	testSubject.setKey(null);
	testSubject.setCache("mycache");
	
	// when
	int actualResult = testSubject.doStartTag();
	
	// then
	Assert.assertEquals(BodyTagSupport.EVAL_BODY_INCLUDE, actualResult);

	// verify cleanup
	Assert.assertNull(testSubject.getCache());
	verifyCleanup();
}
 
开发者ID:psiegman,项目名称:ehcachetag,代码行数:22,代码来源:CacheTagTest.java


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