當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。