javax.servlet.jsp.tagext
Class BodyContent
- Appendable, Closeable, Flushable
BodyContent subclasses JspWriter to accumulate the contents of a
BodyTag. The JSP engine is responsible for creating BodyContent objects;
tags just use them. A BodyTag will generally grab the contents in
its doAfterBody:
void doAfterBody() throws JspException
{
BodyContent body = getBodyContent();
JspWriter out = body.getEnclosingWriter();
try {
body.writeOut(out);
} catch (IOException e) {
throw new JspException(String.valueOf(e));
}
}
clear, clearBuffer, flush, getBufferSize, getRemaining, isAutoFlush, newLine, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println |
clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait |
BodyContent
protected BodyContent(JspWriter prevOut)
Creates a new BodyContent with prevOut as its enclosing writer.
prevOut - the enclosing writer.
clearBody
public void clearBody()
Clears the contents of a body tag.
View More Examples of clearBody()
1: import ;
2: import ;
3: import ;
4: ...
5: InputTag tag = (InputTag) findAncestorWithClass(this, InputTag.class);
6: BodyContent bc = getBodyContent();
7: String body = bc.getString();
8: ...
9: }
10: bc.clearBody();
11: return SKIP_BODY;
View Full Code Here
1: import ;
2: import ;
3:
4: ...
5: InputTag tag = (InputTag) findAncestorWithClass(this, InputTag.class);
6: BodyContent bc = getBodyContent();
7: String body = bc.getString();
8: ...
9: }
10: bc.clearBody();
11: return SKIP_BODY;
View Full Code Here
1: import ;
2: import ;
3:
4: ...
5: SelectTag tag = (SelectTag) findAncestorWithClass(this, SelectTag.class);
6: BodyContent bc = getBodyContent();
7: String selectedValue = bc.getString();
8: ...
9: }
10: bc.clearBody();
11: return SKIP_BODY;
View Full Code Here
1: public int doAfterBody () throws JspException {
2: BodyContent body = getBodyContent();
3: String baseURL = body.getString();
4: ...
5: body.clearBody();
6: try {
7: HttpServletResponse response =
8: (HttpServletResponse) pageContext.getResponse();
View Full Code Here
getEnclosingWriter
public JspWriter getEnclosingWriter()
Returns the encloding writer. For top-level tags, this will be the
JSP page's out. For child tags, this will be the parent's bodyContent.
View More Examples of getEnclosingWriter()
1: public int doEndTag() throws JspTagException {
2: BodyContent bodyContent = getBodyContent();
3: ...
4: if (bodyContent != null) {
5: StringBuffer output = new StringBuffer(bodyContent.getString());
6: ...
7: try {
8: bodyContent.getEnclosingWriter().write(output2);
9: }
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: try {
6: BodyContent bodyContent = getBodyContent();
7: if (bodyContent != null) {
8: ...
9:
10: bodyContent.getEnclosingWriter().write(cleaned);
11: }
View Full Code Here
1: private Tag parent;
2: private BodyContent bodyContent;
3: private PageContext pageContext;
4: ...
5: }
6: public void setBodyContent(BodyContent bodyContent)
7: {
8: ...
9: {
10: bodyContent.writeOut(bodyContent.getEnclosingWriter());
11: }
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: Tag parent;
6: BodyContent body;
7: String tz="GMT";
8: ...
9: public Tag getParent() {return parent;}
10: public void setBodyContent(BodyContent content) {body=content;}
11: public void setPageContext(PageContext pageContext) {}
12: ...
13: format.setTimeZone(TimeZone.getTimeZone(tz));
14: body.getEnclosingWriter().write(format.format(new Date()));
View Full Code Here
1: protected int index = 0;
2: protected BodyContent bodyContent;
3:
4: ...
5: try {
6: bodyContent.writeOut(bodyContent.getEnclosingWriter());
7: return SKIP_BODY;
8: ...
9: }
10: public void setBodyContent(BodyContent bodyContent) {
11: this.bodyContent = bodyContent;
View Full Code Here
getReader
public abstract Reader getReader()
Returns a Reader for accessing the contents of a body tag.
View More Examples of getReader()
1: try {
2: if (bodyContent == null){
3: return EVAL_PAGE;
4: ...
5: try {
6: BodyContent bodyContent = getBodyContent();
7: ...
8: parsed = Pnuts.parse(bodyContent.getReader());
9: parsed = compiler.compile(parsed, context);
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: else {
6: BodyContent bodyContent = getBodyContent();
7:
8: ...
9: source = new StreamSource(bodyContent.getReader());
10: source.setSystemId(((HttpServletRequest) pageContext.getRequest()).getRequestURI());
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: else {
6: BodyContent body = getBodyContent();
7:
8: ...
9: TempCharReader tempReader = (TempCharReader) body.getReader();
10: int ch;
View Full Code Here
getString
public abstract String getString()
Returns a String representing the contents of a body tag.
View More Examples of getString()
1: private ParentTag tag;
2: private BodyContent tempOut;
3:
4: ...
5: tag.doAfterBody();
6: String result = tempOut.getString();
7: assertTrue(result.indexOf("not") > -1);
8: ...
9: tag.doAfterBody();
10: String result = tempOut.getString();
11: assertTrue(result.indexOf("not") == -1);
View Full Code Here
1: try
2: { BodyContent lbc_bodycurrent = getBodyContent();
3:
4: ...
5: {
6: String ls_message = lbc_bodycurrent.getString();
7: JavaScriptExample JS = new JavaScriptExample();
8: ls_alert = JS.alert(ls_message.trim());
9: }
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: {
6: BodyContent content = getBodyContent();
7:
8: ...
9: TagUtils.write(pageContext,
10: StringUtils.limitStringLength(iLimit, content.getString()));
11: }
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: try {
6: final BodyContent bodyOut = getBodyContent();
7: JspWriter out = pageContext.getOut();
8: ...
9: pthinfo,
10: lineNo++, 0, bodyOut.getString());
11: return null;
View Full Code Here
1: import ;
2: import ;
3: import ;
4: ...
5: try {
6: final BodyContent bodyOut = getBodyContent();
7: JspWriter out = pageContext.getOut();
8: ...
9: pthinfo,
10: lineNo++, 0, bodyOut.getString());
11: }
View Full Code Here
writeOut
public abstract void writeOut(Writer out)
throws IOException Writes the contents to the writer.
out - the destination writer .
View More Examples of writeOut(Writer out)
1: try {
2: BodyContent body = getBodyContent();
3: ...
4: body.writeOut(getPreviousOut());
5: body.clearBody();
6: setValue("index", new Integer(++index));
7: return (index <= bis) ? EVAL_BODY_AGAIN : SKIP_BODY;
View Full Code Here
1:
2: BodyContent lbc_bodycurrent = getBodyContent();
3: StringWriter sw = new StringWriter();
4: ...
5: lbc_bodycurrent.writeOut(sw);
6: File f = new File(sw.toString());
7: JAXPTransformerTag tag = (JAXPTransformerTag)findAncestorWithClass(this, com.jspinsider.jspkit.jaxp.JAXPTransformerTag.class);
8: tag.setXMLStreamSource(new StreamSource(f));
View Full Code Here
1: try {
2: BodyContent body = getBodyContent();
3: ...
4: body.writeOut(getPreviousOut());
5: body.clearBody();
6: return r.next() ? EVAL_BODY_AGAIN : SKIP_BODY;
7: }
View Full Code Here
1: private Tag parent;
2: private BodyContent bodyContent;
3: private PageContext pageContext;
4: ...
5: }
6: public void setBodyContent(BodyContent bodyContent)
7: {
8: ...
9: {
10: bodyContent.writeOut(bodyContent.getEnclosingWriter());
11: }
View Full Code Here
1: protected int index = 0;
2: protected BodyContent bodyContent;
3:
4: ...
5: try {
6: bodyContent.writeOut(bodyContent.getEnclosingWriter());
7: return SKIP_BODY;
8: ...
9: }
10: public void setBodyContent(BodyContent bodyContent) {
11: this.bodyContent = bodyContent;
View Full Code Here