下面列出了怎么用javax.servlet.jsp.tagext.SimpleTagSupport的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* {@link ParameterAware}を探して、コールバックします。
* まず、直接の親タグが{@link ParameterAware}かどうか判定します。
* そうであれば、コールバックして終了します。
* もし、直接の親タグが{@link ParameterAware}ない場合、
* {@link SimpleTagSupport#findAncestorWithClass(JspTag, Class)}を利用して、
* ルートまで{@link ParameterAware}を探して辿ります。
* それでも見つからない場合、処理を終了します。
* @throws JspException {@link JspException}
* @throws IOException {@link IOException}
*/
@Override
public void doTag() throws JspException, IOException {
super.doTag();
Args.checkNotEmpty(getName());
JspTag s = getParent();
if (!ParameterAware.class.isInstance(s)) {
s = SimpleTagSupport.findAncestorWithClass(this, ParameterAware.class);
}
if (s == null) return;
ParameterAware parent = (ParameterAware) s;
if (getValues() != null) {
parent.awareParameter(name, getValues());
} else {
parent.awareParameter(name, getValue());
}
}
@SuppressWarnings("unchecked")
protected <T> T findAncestor(Class<? extends BaseTag> clazz) {
return (T) SimpleTagSupport.findAncestorWithClass(this, clazz);
}