Java Code Examples for javax.servlet.jsp.tagext.BodyContent#getEnclosingWriter()

The following examples show how to use javax.servlet.jsp.tagext.BodyContent#getEnclosingWriter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SumBodyTagHandler.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * This method is called after the JSP engine processes the body content of the tag.
 * @return EVAL_BODY_AGAIN if the JSP engine should evaluate the tag body again, otherwise return SKIP_BODY.
 * This method is automatically generated. Do not modify this method.
 * Instead, modify the methods that this method calls.
 */
public int doAfterBody() throws JspException {
    try {
        //
        // This code is generated for tags whose bodyContent is "JSP"
        //
        BodyContent bodyContent = getBodyContent();
        JspWriter out = bodyContent.getEnclosingWriter();
        
        writeTagBodyContent(out, bodyContent);
    } catch (Exception ex) {
        handleBodyContentException(ex);
    }
    
    if (theBodyShouldBeEvaluatedAgain()) {
        return EVAL_BODY_AGAIN;
    } else {
        return SKIP_BODY;
    }
}
 
Example 2
Source File: OtherwiseTag.java    From ontopia with Apache License 2.0 6 votes vote down vote up
/** 
 * Actions after some body has been evaluated.
 */
@Override
public int doAfterBody() throws JspTagException {
  // put out the evaluated body
  BodyContent body = getBodyContent();
  JspWriter out = body.getEnclosingWriter();
  try {
    out.print( body.getString() );
  } catch(IOException ioe) {
    throw new NavigatorRuntimeException("Error in IfTag.", ioe);
  }

  parentChooser.setFoundMatchingWhen();
  
  return SKIP_BODY;
}
 
Example 3
Source File: AssociationTypeLoopTag.java    From ontopia with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
  }
  
}
 
Example 4
Source File: ElementTag.java    From ontopia with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example 5
Source File: IfThenTag.java    From ontopia with Apache License 2.0 5 votes vote down vote up
/**
 * 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 e) {
    throw new NavigatorRuntimeException("Problem occurred when writing to JspWriter in logic:then.", e);
  }

  return SKIP_BODY;
}
 
Example 6
Source File: IfElseTag.java    From ontopia with Apache License 2.0 5 votes vote down vote up
/**
 * 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;
}