Custom Tag In Java

Custom Tag Library use to make own tag in jsp by extending TagSupport class, build xml with (.tld) extension file, which specify the result would you want to use.
Java Server Page (JSP) contain standard tag library @taglib for including (.tld) file.

public class CustomTagTest extends TagSupport {

public CustomTagTest() { }

@Override
public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();//returns the instance of JspWriter
   try{

    System.out.println("do start tag sections.");
    out.print(Calendar.getInstance().getTime());//printing date and time using JspWriter
    out.print(" Current Timestamp is : ");
   } catch(Exception e) {
    System.out.println(e);
   }
   System.out.println("SKIP_PAGE : Return");
   //return SKIP_BODY;//will not evaluate the body content of the tag
   return SKIP_PAGE;
}

@Override
public int doAfterBody() throws JspException {
System.out.println("do After body sections.");
return SKIP_PAGE;
}

@Override
public int doEndTag() throws JspException {
System.out.println("do end tag sections.");
return super.doEndTag();
}
}

myCustomTag.tld file.  On the basis of this tag name you are able to use tag with prefix.
<taglib>

<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>simple</short-name>
<uri>http://tomcat.apache.org/example-taglib</uri>

<tag>
<name>today</name>
<tag-class>com.custom.tag.MyTagHandler</tag-class>
</tag>

</taglib>

Java Server Page (JSP).
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="WEB-INF/myCustomTag.tld" prefix="m" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Custom Tag Test Page!</title>
</head>
<body>
    
Current Date and Time is:   <m:today/>  
            
</body>
</html>