newtag.java

来自「学生管理系统」· Java 代码 · 共 54 行

JAVA
54 行
字号
package cn.jl.student.servlet;

import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspWriter;
import java.io.IOException;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2008-8-22
 * Time: 19:15:20
 * To change this template use File | Settings | File Templates.
 */
public class NewTag extends TagSupport {
    private String width = "";
    private String height = "";
    private String bgcolor = "";

    public void setwidth(String width){
        this.width = width;
    }

    public void setheight(String height) {
        this.height = height;
    }

    public void setbgcolor(String bgcolor) {
        this.bgcolor = bgcolor;
    }
    public int doStartTag(){
        JspWriter out = pageContext.getOut();
        try {
            out.println("<table width='" + this.width + "',height='" + this.height + "',bgcolor='" + this.bgcolor + "'>");
            out.println("   <tr>");
            out.println("       <td>");

        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        return EVAL_BODY_INCLUDE;

    }
    public int doEndTag(){
        JspWriter out = pageContext.getOut();

        try {
            out.println("       </td>");
            out.println("   </>tr");
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }
}

⌨️ 快捷键说明

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