package com.itheima.domain;
import java.io.IOException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.Tag;
public class Demo4Tag extends BodyTagSupport {
public int doStartTag() throws JspException {
return BodyTag.EVAL_BODY_BUFFERED;
}
public int doEndTag() throws JspException {
//得到主体内容
String content = bodyContent.getString();
//变为大写后再输出
content = content.toUpperCase();
try {
pageContext.getOut().write(content);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Tag.EVAL_PAGE;
}
}
|
|