oktag.java
来自「是JSP、Servlet的一个示例程序」· Java 代码 · 共 46 行
JAVA
46 行
/*
* Created on 2005-3-8
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package test;
import java.io.IOException;
import java.util.Date;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.tagext.TagSupport;
/**
* @author yangbing
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class OkTag extends TagSupport {
public int doStartTag() throws JspTagException {
String dateString = new Date().toString();
try {
pageContext.getOut().write("Ok it is second tag. <br/>");
pageContext.getOut().write(
"My name is " + getClass().getName() + " and it's "
+ dateString + "<p/>");
} catch (IOException ex) {
throw new JspTagException(
"Fatal error: hello tag could not write to JSP out");
}
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspTagException {
/*
* String dateString=new Date().toString(); try{
* pageContext.getOut().write("Ok it is second tag. <br/>");
* pageContext.getOut().write("My name is "+getClass().getName()+" and
* it's "+dateString+" <p/>"); }catch(IOException ex){ throw new
* JspTagException("Fatal error: hello tag could not write to JSP out"); }
*/
return EVAL_PAGE;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?