类 TagWriter
- java.lang.Object
- org.springframework.web.servlet.tags.form.TagWriter
构造器概要
构造器 构造器 说明 TagWriter(Writer writer)
TagWriter(PageContext pageContext)
Create a new instance of theTagWriter
class that writes to the suppliedPageContext
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
appendValue(String value)
Close the current opening tag (if necessary) and appends the supplied value as inner text.void
endTag()
Close the current tag.void
endTag(boolean enforceClosingTag)
Close the current tag, allowing to enforce a full closing tag.void
forceBlock()
Indicate that the currently open tag should be closed and marked as a block level element.void
startTag(String tagName)
Start a new tag with the supplied name.void
writeAttribute(String attributeName, String attributeValue)
Write an HTML attribute with the specified name and value.void
writeOptionalAttributeValue(String attributeName, String attributeValue)
Write an HTML attribute if the supplied value is notnull
or zero length.
构造器详细资料
TagWriter
public TagWriter(PageContext pageContext)
Create a new instance of theTagWriter
class that writes to the suppliedPageContext
.- 参数:
pageContext
- the JSP PageContext to obtain theWriter
from
方法详细资料
startTag
public void startTag(String tagName) throws JspException
Start a new tag with the supplied name. Leaves the tag open so that attributes, inner text or nested tags can be written into it.- 抛出:
JspException
- 另请参阅:
endTag()
writeAttribute
public void writeAttribute(String attributeName, String attributeValue) throws JspException
Write an HTML attribute with the specified name and value.Be sure to write all attributes before writing any inner text or nested tags.
- 抛出:
IllegalStateException
- if the opening tag is closedJspException
writeOptionalAttributeValue
public void writeOptionalAttributeValue(String attributeName, @Nullable String attributeValue) throws JspException
Write an HTML attribute if the supplied value is notnull
or zero length.
appendValue
public void appendValue(String value) throws JspException
Close the current opening tag (if necessary) and appends the supplied value as inner text.- 抛出:
IllegalStateException
- if no tag is openJspException
forceBlock
public void forceBlock() throws JspException
Indicate that the currently open tag should be closed and marked as a block level element.Useful when you plan to write additional content in the body outside the context of the current
TagWriter
.- 抛出:
JspException
endTag
public void endTag() throws JspException
Close the current tag.Correctly writes an empty tag if no inner text or nested tags have been written.
- 抛出:
JspException
endTag
public void endTag(boolean enforceClosingTag) throws JspException
Close the current tag, allowing to enforce a full closing tag.Correctly writes an empty tag if no inner text or nested tags have been written.
- 参数:
enforceClosingTag
- whether a full closing tag should be rendered in any case, even in case of a non-block tag- 抛出:
JspException