如何写一个自定义标签
2023-06-30
答:代码如下:
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;
public class TimeTag extends SimpleTagSupport
private boolean isServer = true;
public void setServer(boolean isServer)
this.isServer = isServer;
第45 页共59 页
public void doTag() throws JspException, IOException
JspWriter out = getJspContext().getOut();
if(isServer)
out.println(new java.util.Date());
else
out.println(“”);