package class3g.web.simpleTag;
import java.io.IOException;
import java.io.StringWriter;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.JspFragment;
import javax.servlet.jsp.tagext.SimpleTagSupport;
//控制標籤體輸出
public class SimpleTag1 extends SimpleTagSupport {
public void doTag() throws JspException, IOException {
JspFragment jf=this.getJspBody();//讀標籤體內容
//循環輸出標籤體內容
// for(int i=0;i<10;i++){
//jf.invoke(null);
// jf.invoke(this.getJspContext().getOut());//invoke輸出頁面
// }
//忽略本標籤之後的jsp代碼
// throw new SkipPageException();
//大小寫轉換
StringWriter sw = new StringWriter();
jf.invoke(sw);
String content = sw.getBuffer().toString();
content = content.toUpperCase();
JspWriter out= this.getJspContext().getOut();
out.write(content);
}
}