请问一下有关自定义标签库的问题?

CityFantom 2004-04-02 03:14:35
TagExtraInfo类有什么作用,VariableInfo类也是什么与TagExtraInfo有什么关系?
小弟的E文很差!看了半天有关JBuilder帮助也没看明白!以下是自定义标签库的处理代
码:
public class FooTag exends ExampleTagBase implements BodyTag {
private String atts[] = new String[3];
int i = 0;

private final void setAtt(int index , String value) {
atts[index] = value;
}
// 在这个标签中定义了三个属性 att1 att2 att3
public void setAtt1(String value) {
setAtt(0 , value);
}

public void setAtt2(String value) {
setAtt(1 , value);
}

public void setAtt3(String value) {
setAtt(2 , value);
}

public void doInitBody() throws JspException {
pageContext.setAttribute("member" , atts[i]);
i++;
}

public int doAfterBody() throws JspException {
try {
if (i == 3) {
bodyOut.writeOut(bodyOut.getEnclosingWriter());
return SKIP_BODY;
}
else {
pageContext.setAttribute("member" , attrs[i]);
}
i++;
return EVAL_BODY_TAG;
} catch (EOException ex) {
throw new JspTagException(ex.toString());
}
}
}

public class FooTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo ( TagData data ) {
return new VariableInfo[]
{ new VariableInfo("member" , "String" , true , VariableInfo.NESTED) }
}
}

...全文
40 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,090

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧