exampletag.java

来自「servlet与jsp核心编程 书籍源码 部分」· Java 代码 · 共 32 行

JAVA
32
字号
package coreservlets.tags;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;import java.io.*;/** Very simple JSP tag that just inserts a string *  ("Custom tag example...") into the output. *  The actual name of the tag is not defined here; *  that is given by the Tag Library Descriptor (TLD) *  file that is referenced by the taglib directive *  in the JSP file. *  <P> *  Taken from Core Servlets and JavaServer Pages *  from Prentice Hall and Sun Microsystems Press, *  http://www.coreservlets.com/. *  &copy; 2000 Marty Hall; may be freely used or adapted. */public class ExampleTag extends TagSupport {  public int doStartTag() {    try {      JspWriter out = pageContext.getOut();      out.print("Custom tag example " +                "(coreservlets.tags.ExampleTag)");    } catch(IOException ioe) {      System.out.println("Error in ExampleTag: " + ioe);    }    return(SKIP_BODY);  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?