simpleattributetag.java
来自「一个免费wap站」· Java 代码 · 共 43 行
JAVA
43 行
package com.eline.wap.catalog.taglib.wml;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
import com.eline.wap.common.util.AppLogger;
public abstract class SimpleAttributeTag extends TagSupport {
protected Object item = null;
protected String name = null;
public int doStartTag() throws JspException {
// check if itemAttribute tag is in items tag
SimpleTag simpleTag = (SimpleTag) findAncestorWithClass(this, SimpleTag.class);
if (simpleTag == null) {
throw new JspTagException("SimpleAttributeTag: itemsAttribute tag not inside parent tag");
}
item = simpleTag.getItem();
// print out attribute
try {
JspWriter out = pageContext.getOut();
out.print(createText());
} catch(IOException e) {
AppLogger.error("SimpleAttributeTag: Error printing attribute: " + e);
}
// there should be no body to process
return SKIP_BODY;
}
public void setName(String name) {
this.name = name;
}
protected abstract String createText();
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?