|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.servlet.jsp.tagext Class TagExtraInfo
java.lang.Object javax.servlet.jsp.tagext.TagExtraInfo
public abstract class TagExtraInfo
- extends Object
标记库作者提供的可选类,用于描述 TLD 中没有描述的其他转换期间信息。标记库描述符文件 (TLD) 中提到过 TagExtraInfo 类。
此类可用于:
- 指示标记定义了脚本变量
- 执行标记属性的转换期间验证。
JSP 转换器负责使调用 getTagInfo() 返回的初始值对应于将被转换的标记的 TagInfo 对象。如果对 setTagInfo() 进行显式调用,则传递的对象将在 getTagInfo() 的后续调用中返回。
影响 getTagInfo() 返回的值的唯一方式是通过 setTagInfo() 调用,因此将通过 JSP 转换器使用对应于将被转换的标记的 TagInfo 对象调用 TagExtraInfo.setTagInfo()。该调用应该发生在任何 validate() 调用和任何 getVariableInfo() 调用之前。
注:如果 TLD 中的标记定义如下:一个或多个变量子元素拥有的关联 TagExtraInfo 实现所返回的 VariableInfo 调用 getVariableInfo() 将返回一个或多个元素,那么这是一个(转换期间)错误。
Optional class provided by the tag library author to describe additional translation-time information not described in the TLD. The TagExtraInfo class is mentioned in the Tag Library Descriptor file (TLD).
This class can be used:
- to indicate that the tag defines scripting variables
- to perform translation-time validation of the tag attributes.
It is the responsibility of the JSP translator that the initial value to be returned by calls to getTagInfo() corresponds to a TagInfo object for the tag being translated. If an explicit call to setTagInfo() is done, then the object passed will be returned in subsequent calls to getTagInfo().
The only way to affect the value returned by getTagInfo() is through a setTagInfo() call, and thus, TagExtraInfo.setTagInfo() is to be called by the JSP translator, with a TagInfo object that corresponds to the tag being translated. The call should happen before any invocation on validate() and before any invocation on getVariableInfo().
NOTE: It is a (translation time) error for a tag definition in a TLD with one or more variable subelements to have an associated TagExtraInfo implementation that returns a VariableInfo array with one or more elements from a call to getVariableInfo().
Constructor Summary | |
---|---|
TagExtraInfo()
Sole constructor. |
Method Summary | |
---|---|
TagInfo |
getTagInfo()
Get the TagInfo for this class. |
VariableInfo[] |
getVariableInfo(TagData data)
information on scripting variables defined by the tag associated with this TagExtraInfo instance. |
boolean |
isValid(TagData data)
Translation-time validation of the attributes. |
void |
setTagInfo(TagInfo tagInfo)
Set the TagInfo for this class. |
ValidationMessage[] |
validate(TagData data)
Translation-time validation of the attributes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public
TagExtraInfo()
唯一的构造方法。(由子类构造方法调用,通常是隐式的)。
英文文档:
TagExtraInfo
public TagExtraInfo()
- Sole constructor. (For invocation by subclass constructors,
typically implicit.)
Method Detail |
---|
public VariableInfo[]
getVariableInfo(TagData data)
与此 TagExtraInfo 实例关联的由标记定义的脚本变量的信息。请求期间属性通过 TagData 参数的值指定。
data | TagData 实例。 |
return | VariableInfo 数据数组,如果没有要定义的脚本变量,则返回 null 或长度为 0 的数组。 |
getVariableInfo
public VariableInfo[] getVariableInfo(TagData data)
- information on scripting variables defined by the tag associated with
this TagExtraInfo instance.
Request-time attributes are indicated as such in the TagData parameter.
- Parameters:
data
- The TagData instance.- Returns:
- An array of VariableInfo data, or null or a zero length array if no scripting variables are to be defined.
public boolean
isValid(TagData data)
属性的转换期间验证。请求期间属性通过 TagData 参数的值指定。注意,执行验证的首选方式是使用 validate() 方法,因为它可以返回更详细的信息。
data | TagData 实例。 |
return | 此标记实例是否有效。 |
See also | validate |
isValid
public boolean isValid(TagData data)
- Translation-time validation of the attributes.
Request-time attributes are indicated as such in the TagData parameter.
Note that the preferred way to do validation is with the validate()
method, since it can return more detailed information.
- Parameters:
data
- The TagData instance.- Returns:
- Whether this tag instance is valid.
- See Also:
validate(javax.servlet.jsp.tagext.TagData)
public ValidationMessage[]
validate(TagData data)
属性的转换期间验证。请求期间属性通过 TagData 参数的值指定。因为可能提供更高质量的验证消息,所以这是执行验证的首选方式(尽管 isValid() 仍然有效)。
JSP 2.0 和更高版本的容器将调用 validate(),而不是 isValid()。此方法的默认实现是调用 isValid()。如果 isValid() 返回 false,则返回指示 isValid() 返回 false 的一般 ValidationMessage[]。
data | TagData 实例。 |
return | 一个 null 对象,如果没有错误,则返回长度为 0 的数组,否则返回 ValidationMessage 数组。 |
since | 2.0 |
validate
public ValidationMessage[] validate(TagData data)
- Translation-time validation of the attributes.
Request-time attributes are indicated as such in the TagData parameter.
Because of the higher quality validation messages possible,
this is the preferred way to do validation (although isValid()
still works).
JSP 2.0 and higher containers call validate() instead of isValid(). The default implementation of this method is to call isValid(). If isValid() returns false, a generic ValidationMessage[] is returned indicating isValid() returned false.
- Parameters:
data
- The TagData instance.- Returns:
- A null object, or zero length array if no errors, an array of ValidationMessages otherwise.
- Since:
- JSP 2.0
final public void
setTagInfo(TagInfo tagInfo)
设置此类的 TagInfo。
tagInfo | 此实例要扩展的 TagInfo |
setTagInfo
public final void setTagInfo(TagInfo tagInfo)
- Set the TagInfo for this class.
- Parameters:
tagInfo
- The TagInfo this instance is extending
final public TagInfo
getTagInfo()
获取此类的 TagInfo。
return | 此实例要扩展的 taginfo 实例 |
getTagInfo
public final TagInfo getTagInfo()
- Get the TagInfo for this class.
- Returns:
- the taginfo instance this instance is extending
|
|||||||||
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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!