Custom classes:Importjava.io.IOException;ImportJava.io.PrintWriter;Importjavax.servlet.ServletRequest;ImportJavax.servlet.ServletResponse;Importjavax.servlet.jsp.JspException;ImportJavax.servlet.jsp.tagext.TagSupport; Public classCalctagextendsTagSupport {Private intNumA; Private intNumB; Public intGetnuma () {returnNumA; } Public voidSetnuma (intNumA) { This. NumA =NumA; } Public intGetnumb () {returnNumB; } Public voidSetnumb (intNumB) { This. NumB =NumB; } @Override Public intdoStartTag ()throwsjspexception {servletresponse sr=Super. Pagecontext.getresponse (); Try{PrintWriter out=Sr.getwriter (); Out.println ("); Out.print (NumA); Out.print ("+"); Out.print (NumB); Out.print ("="); Out.println (NumA+NumB); Out.println ("); Out.flush (); Out.close (); } Catch(IOException e) {e.printstacktrace (); } returnSkip_body; Create a file with a suffix of TLD:<?xml version= "1.0" encoding= "UTF-8"? ><taglib version= "2.0" xmlns= "HTTP://JAVA.SUN.COM/XML/NS/J2EE"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "Http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd" > <tlib-version>1.0</tlib-version> <jsp-version>2.0</jsp-version> < Short-name>example TLD with body</ Short-name> <tag> <name>calc</name> <tag-class>com.wisezone.tag.calctag</tag-class> <body-content>empty</body-content> <attribute> <NAME>NUMA</NAME&G T <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>numB</name>//The first letter of the variable name cannot be capitalized<required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> </tag></taglib>Configure registration in Web. XML:<?xml version= "1.0" encoding= "UTF-8"? ><web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "id=" webapp_id "version=" 3.1 "> <display-name>tagweb</ display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> </ Welcome-file-list> <!--registration-<jsp-config> <taglib> <TAGLIB-URI>/WISEZONE</TAGL ib-uri> <taglib-location>/WEB-INF/mytag.tld</taglib-location> </taglib> </jsp-config> ;</web-app>JSP pages use:<%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding= "UTF-8"%><% @taglib uri= "/wisezone" prefix= "C"%> <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >Custom labels for notes _java