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


Java BodyContent.clearBody方法代码示例

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


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

示例1: doEndTag

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doEndTag() {
    try {
        BodyContent body = getBodyContent();

        if (body != null) {
            JspWriter out = body.getEnclosingWriter();
            String bodyString = body.getString();
            body.clearBody();
            out.print(bodyString);
        }
    } catch (IOException e) {
        System.out.println("IterateNext Tag error: " + e);
    }
    return EVAL_PAGE;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:17,代码来源:IterateNextTag.java

示例2: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {

  // retrieve parent tag which accepts the result of this operation
  ValueAcceptingTagIF acceptingTag = (ValueAcceptingTagIF)
    findAncestorWithClass(this, ValueAcceptingTagIF.class);

  // get body content which should contain the string we want to set.
  BodyContent body = getBodyContent();
  String content = body.getString();

  // construct new collection which consists of one String entry
  // kick it over to the nearest accepting tag
  acceptingTag.accept( Collections.singleton(content) );

  // reset body contents
  body.clearBody();
  
  return SKIP_BODY;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:24,代码来源:StringTag.java

示例3: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  ElementTag elementTag = (ElementTag)
    findAncestorWithClass(this, ElementTag.class);

  if (elementTag != null) {
    // get body content
    BodyContent body = getBodyContent();
    if (body != null) {
      String content = body.getString();
      // add this attribute to parent element tag 
      elementTag.addAttribute(attrName, content);
      body.clearBody();
    } else {
      log.warn("AttributeTag: body content is null!");
    }
  } else {
    log.warn("AttributeTag: no parent element tag found!");
  }
  
  // only evaluate body once
  return SKIP_BODY;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:27,代码来源:AttributeTag.java

示例4: doEndTag

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doEndTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    BodyContent body = getBodyContent();
    String bodyString = body.getString();

    StringBuilder newURL = new StringBuilder();

    appendContentPrefix(request, newURL);
    newURL.append(bodyString);
    body.clearBody();

    try {
        getPreviousOut().print(newURL.toString());
    } catch (IOException e) {
        if (UtilJ2eeCompat.useNestedJspException(pageContext.getServletContext())) {
            throw new JspException(e.getMessage(), e);
        } else {
            Debug.logError(e, "Server does not support nested exceptions, here is the exception", module);
            throw new JspException(e.toString());
        }
    }
    return SKIP_BODY;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:26,代码来源:ContentUrlTag.java

示例5: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  // put out the evaluated body
  BodyContent body = getBodyContent();
  JspWriter out = null;
  try {
    out = body.getEnclosingWriter();
    out.print(body.getString());
    body.clearBody();
  } catch(IOException ioe) {
    throw new NavigatorRuntimeException("Error in AssociationTypeLoopTag.", ioe);
  }

  // test if we have to repeat the body 
  if (index < assocStore.length) {
    // set to next value in list
    setVariableValues(assocStore[index]);
    index++;
    return EVAL_BODY_AGAIN;
  } else {
    return SKIP_BODY;
  }
  
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:28,代码来源:AssociationTypeLoopTag.java

示例6: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
    * Method called at end of format tag body.
    *
    * @return SKIP_BODY
    */
   @Override
public final int doAfterBody() throws JspException
   {
       // Use the body of the tag as input for the date
       BodyContent body = getBodyContent();
       String s = body.getString().trim();  
       // Clear the body since we will output only the formatted date
       body.clearBody();
       if( output_date == null ) {
           long time;
           try {
               time = Long.valueOf(s).longValue();
               output_date = new Date(time);
           } catch(NumberFormatException nfe) {
           }
       }

       return SKIP_BODY;
   }
 
开发者ID:lucee,项目名称:Lucee,代码行数:25,代码来源:FormatTag.java

示例7: doEndTag

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doEndTag() {
    try {
        BodyContent body = getBodyContent();

        if (body != null) {
            JspWriter out = body.getEnclosingWriter();
            String bodyString = body.getString();
            body.clearBody();
            out.print(bodyString);
        }
    } catch (IOException e) {
        Debug.logInfo("IteratorTag IO Error", module);
        Debug.logInfo(e, module);
    }
    return EVAL_PAGE;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:18,代码来源:IteratorTag.java

示例8: doEndTag

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doEndTag() {
    try {
        BodyContent body = getBodyContent();

        if (body != null) {
            JspWriter out = body.getEnclosingWriter();
            String bodyString = body.getString();
            body.clearBody();
            //Debug.logInfo("printing string: " + bodyString, module);
            out.print(bodyString);
        }
    } catch (IOException e) {
        Debug.logError(e, "IfTag Error.", module);
    }
    return EVAL_PAGE;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:18,代码来源:IfTag.java

示例9: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doAfterBody() throws JspException {
    try {
        BodyContent body = getBodyContent();

        if (body != null) {
            JspWriter out = body.getEnclosingWriter();
            out.println(body.getString());
            body.clearBody(); // Clear for next evaluation
        }
    } catch (IOException e) {
        throw new JspException("could not write body", e);
    }

    return goNext(false);
}
 
开发者ID:FenixEdu,项目名称:bennu-renderers,代码行数:17,代码来源:MessagesTag.java

示例10: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  BodyContent body = getBodyContent();
  StringBuilder complElem = new StringBuilder(100);
  complElem.append("<").append(elemName);
  // put in attribute-value pairs
  Iterator it = attrnames.iterator();
  String key, val;    
  while (it.hasNext()) {
    key = (String) it.next();
    val = (String) attrs.get(key);
    complElem.append(" ").append(key).append("='").append(val).append("'");
  }
  complElem.append(">");

  // append body content
  complElem.append( body.getString() );
  complElem.append("</").append(elemName).append(">");
  
  // write it out
  try {
    JspWriter out = body.getEnclosingWriter();
    out.print( complElem.toString() );
    body.clearBody();
  } catch (IOException ioe) {
    throw new NavigatorRuntimeException("Error in ElementTag. JspWriter not there.", ioe);
  }
  
  // only evaluate body once
  return SKIP_BODY;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:35,代码来源:ElementTag.java

示例11: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
/**
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  // we have already checked the condition in doStartTag
  try {
    BodyContent body = getBodyContent();
    JspWriter out = body.getEnclosingWriter();
    out.print( body.getString() );
    body.clearBody();
  } catch(IOException ioe) {
    throw new JspTagException("Problem occurred when writing to JspWriter in logic:else: " + ioe);
  }

  return SKIP_BODY;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:18,代码来源:IfElseTag.java

示例12: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doAfterBody() throws JspException {
  BodyContent bodyContent = getBodyContent();
  String content = bodyContent.getString();

  // save body content into params after evaluation
  if (log.isDebugEnabled())
    log.debug("doAfterBody: register variable '"+name+"'.");

  putParameter(content, true);

  bodyContent.clearBody();
  return SKIP_BODY;
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:15,代码来源:PutTag.java

示例13: doEndTag

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
@Override
public int doEndTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();

    ServletContext context = (ServletContext) request.getAttribute("servletContext");
    RequestHandler rh = (RequestHandler) context.getAttribute("_REQUEST_HANDLER_");

    BodyContent body = getBodyContent();

    String baseURL = body.getString();
    String newURL = rh.makeLink(request, response, baseURL);

    body.clearBody();

    try {
        getPreviousOut().print(newURL);
    } catch (IOException e) {
        if (UtilJ2eeCompat.useNestedJspException(pageContext.getServletContext())) {
            throw new JspException(e.getMessage(), e);
        } else {
            Debug.logError(e, "Server does not support nested exceptions, here is the exception", module);
            throw new JspException(e.toString());
        }
    }
    return SKIP_BODY;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:28,代码来源:UrlTag.java

示例14: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
public int doAfterBody() throws JspTagException {
	BodyContent body = getBodyContent();
	try {
		JspWriter out = getPreviousOut();
		out.write("<title>");
		body.writeOut(out);
		out.write("</title>");
	} catch (IOException e) {
		throw new JspTagException(e.getMessage());
	}

	body.clearBody();
	return SKIP_BODY;
}
 
开发者ID:yangjm,项目名称:winlet,代码行数:15,代码来源:TitleTag.java

示例15: doAfterBody

import javax.servlet.jsp.tagext.BodyContent; //导入方法依赖的package包/类
public int doAfterBody() throws JspTagException {
	BodyContent body = getBodyContent();
	try {
		body.writeOut(getPreviousOut());
	} catch (IOException e) {
		throw new JspTagException(e.getMessage());
	}

	body.clearBody();
	return SKIP_BODY;
}
 
开发者ID:yangjm,项目名称:winlet,代码行数:12,代码来源:WhenTag.java


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