Jsp tag technology is very practical. This is not the case, so it will be used for internships at the company. I use a jsp label to encapsulate jqGrid (a table plug-in of jQuery). Using a select statement, I can automatically build a table and obtain parameters from the database. The entire small architecture will not be sent out, because I have encapsulated the jqGrid table twice. If you want it again, you can leave a message. The following describes how to use custom jsp labels. 1. The parsing class for writing a tag must inherit the TagSupport class. Simply rewrite doStartTag () or doEndTag. Package com. lubby. tag; import java. io. IOException; import java. util. properties; import javax. servlet. jsp. jspException; import javax. servlet. jsp. tagext. tagSupport; import org. apache. struts2.ServletActionContext; import com. lubby. util. propertiesUtil; import com. opensymphony. xwork2.ActionContext; public class jqgrid extends TagSupport {private String SQL; @ Overridepublic int doEndTag () throws JspException {tr Y {PropertiesUtil. setProperties (SQL); System. out. println (SQL); pageContext. getOut (). print ("<div id = \" content \ "> <table id = \" gridTable \ "> </table> <div id = \" gridPager \ "style = \" height: 40px \ "> </div>");} catch (IOException e) {e. printStackTrace ();} return EVAL_PAGE;} public void setSql (String SQL) {this. SQL = SQL;} public String getSql () {return SQL;} 2. Create a tld file (the taglib of tld has two types of references, so I don't need to use web. xml configuration) <? Xml version = "1.0" encoding = "UTF-8" standalone = "no"?> <Taglib xmlns =" http://java.sun.com/xml/ns/j2ee "Xmlns: xsi =" http://www.w3.org/2001/XMLSchema-instance "Version =" 2.0 "xsi: schemaLocation =" http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee /Web-jsptaglibrary_2_0.xsd "> <description> <! [CDATA ["To make it easier to access dynamic data; "]> </description> <display-name> Permission Tags </display-name> <tlib-version> 1.0 </tlib-version> <short-name> lubby </short-name> <uri> www.lubby.com </uri> // when declaring a tag, use <tag> <name> jqgrid </name> // sign the tag in jsp <tag -class> com. lubby. tag. jqgrid </tag-class> // explanation class of the tag <body-content> empty </body-content> // No body <attribute> // set the parameter <name> SQL </name> // The parameter name is SQL <requ Ired> true </required> // The parameter is required. <fragment> true </fragment> </attribute> </tag> </taglib> 3. Use label 1. declare the tag <% @ taglib prefix = "s" uri = "www.lubby.com" %> 2. label <s: jqgrid SQL = "select t1.id as number, t1.bussiness as business type, t1.customer as mobile phone number, t1.brand as brand from info t1"/> 3. the code generated during client access is: <div id = "content"> <table id = "gridTable"> </table> <div id = "gridPager" style = "height: 40px "> </div> note that the original custom jsp tag Reason: jsp will eventually be converted to servlet, And the custom tag will also be converted into executing code in servlet. servlet will return the html code to the client, and the client (browser) will explain the received html code. Custom tags are converted from the app server into html code. The client actually accesses html pages that have been converted.