|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.servlet.jsp.tagext Class BodyContent
java.lang.Object java.io.Writer javax.servlet.jsp.JspWriter javax.servlet.jsp.tagext.BodyContent
- All Implemented Interfaces:
- Closeable, Flushable, Appendable
public abstract class BodyContent
- extends JspWriter
对某一操作正文求值的封装,因此它可用于标记处理程序。BodyContent 是 JspWriter 的子类。
注意,BodyContent 的内容是求值的结果,因此除了操作调用的结果外,它不会包含任何操作和类似的东西。
BodyContent 有一些方法,这些方法可将其内容转换为 String、读取其内容和清除内容。
BodyContent 对象的缓冲区大小是无界的。BodyContent 对象不能处于 autoFlush 模式。不可能对 BodyContent 对象调用 flush,因为没有回溯流。
BodyContent 实例是通过调用 PageContext 类的 pushBody 和 popBody 方法创建的。BodyContent 按照与其关联的操作的结构被封闭在另一个 JspWriter(可能是另一个 BodyContent 对象)内。
通过调用 setBodyContent() 使 BodyContent 可用于 BodyTag。直到调用 doEndTag() 后,标记处理程序才可以使用该对象。
An encapsulation of the evaluation of the body of an action so it is available to a tag handler. BodyContent is a subclass of JspWriter.
Note that the content of BodyContent is the result of evaluation, so it will not contain actions and the like, but the result of their invocation.
BodyContent has methods to convert its contents into a String, to read its contents, and to clear the contents.
The buffer size of a BodyContent object is unbounded. A BodyContent object cannot be in autoFlush mode. It is not possible to invoke flush on a BodyContent object, as there is no backing stream.
Instances of BodyContent are created by invoking the pushBody and popBody methods of the PageContext class. A BodyContent is enclosed within another JspWriter (maybe another BodyContent object) following the structure of their associated actions.
A BodyContent is made available to a BodyTag through a setBodyContent() call. The tag handler can use the object until after the call to doEndTag().
Field Summary |
---|
Fields inherited from class javax.servlet.jsp.JspWriter |
---|
autoFlush, bufferSize, DEFAULT_BUFFER, NO_BUFFER, UNBOUNDED_BUFFER |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
protected |
BodyContent(JspWriter e)
Protected constructor. |
Method Summary | |
---|---|
void |
clearBody()
Clear the body without throwing any exceptions. |
void |
flush()
Redefined flush() so it is not legal. |
JspWriter |
getEnclosingWriter()
Get the enclosing JspWriter. |
abstract Reader |
getReader()
Return the value of this BodyContent as a Reader. |
abstract String |
getString()
Return the value of the BodyContent as a String. |
abstract void |
writeOut(Writer out)
Write the contents of this BodyContent into a Writer. |
Methods inherited from class javax.servlet.jsp.JspWriter |
---|
clear, clearBuffer, close, getBufferSize, getRemaining, isAutoFlush, newLine, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println |
Methods inherited from class java.io.Writer |
---|
append, append, append, write, write, write, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected
BodyContent(JspWriter e)
受保护的构造方法。
无界缓冲区,不执行自动刷新。
e | 封闭的 JspWriter |
BodyContent
protected BodyContent(JspWriter e)
- Protected constructor.
Unbounded buffer, no autoflushing.
- Parameters:
e
- the enclosing JspWriter
Method Detail |
---|
public void
flush() throws java.io.IOException
重定义的 flush(),因此它是不合法的。
刷新 BodyContent 是无效的,因为它后面没有回溯流。
Throws | java.io.IOException: 始终抛出 |
flush
public void flush() throws IOException
- Redefined flush() so it is not legal.
It is not valid to flush a BodyContent because there is no backing stream behind it.
- Throws:
IOException
- always thrown
public void
clearBody()
清除正文,不抛出任何异常。
英文文档:
clearBody
public void clearBody()
- Clear the body without throwing any exceptions.
abstract public java.io.Reader
getReader()
以 Reader 形式返回此 BodyContent 的值。
return | Reader 形式的此 BodyContent 的值 |
getReader
public abstract Reader getReader()
- Return the value of this BodyContent as a Reader.
- Returns:
- the value of this BodyContent as a Reader
abstract public String
getString()
以 String 形式返回 BodyContent 的值。
return | String 形式的 BodyContent 的值 |
getString
public abstract String getString()
- Return the value of the BodyContent as a String.
- Returns:
- the value of the BodyContent as a String
abstract public void
writeOut(java.io.Writer out) throws java.io.IOException
将此 BodyContent 的内容写入 Writer。子类可优化常用调用模式。
out | 要放置此正文求值的内容的 Writer |
Throws | java.io.IOException: 如果在将此 BodyContent 的内容写入给定 Writer 时发生 I/O 错误 |
writeOut
public abstract void writeOut(Writer out) throws IOException
- Write the contents of this BodyContent into a Writer.
Subclasses may optimize common invocation patterns.
- Parameters:
out
- The writer into which to place the contents of this body evaluation- Throws:
IOException
- if an I/O error occurred while writing the contents of this BodyContent to the given Writer
public JspWriter
getEnclosingWriter()
获取封闭的 JspWriter。
return | 构造时传递的封闭 JspWriter |
getEnclosingWriter
public JspWriter getEnclosingWriter()
- Get the enclosing JspWriter.
- Returns:
- the enclosing JspWriter passed at construction time
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!