什么也不说,直接上代码:
import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.SkipPageException; import javax.servlet.jsp.tagext.SimpleTagSupport; //控制标签余下的jsp不执行 public class SimpleTagDemo4 extends SimpleTagSupport { @Override public void doTag() throws JspException, IOException { throw new SkipPageException(); } }
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@taglib uri="/simpleitcast" prefix="itcast"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <itcast:demo4/> <html> <head> <title>控制标签余下的 jsp不执行</title> </head> <body> </body> </html>
<tag> <name>demo4</name> <!-- 为标签处理器类配一个标签名 --> <tag-class>cn.itcast.web.simpletag.SimpleTagDemo4</tag-class> <body-content>scriptless</body-content> </tag>