Tag similar to an ASP. NET user control for dynamically displaying HTML
I first set up the tags directory in the project/webcontent/web-inf/to store the tag file
Create a new Message.tag file, as follows:
<%@ Tag Language="Java"pageencoding="UTF-8"%><%@ attribute Name="ID"type="java.lang.String"Required="true"Description="ID"%><%@ attribute Name="msg"type="java.lang.String"Required="true"Description="display text"%><%@ attribute Name="Description"type="java.lang.String"Required="false"Description="Tips" %><DivID= "${id}">message: ${msg}<BR/>Description:<span>${description}</span></Div>
To be used in the JSP interface, first introduce
<% @ taglib Prefix = " Tags " Tagdir = " /web-inf/tags " %>
Use:
<id= "msg" msg= "RHYTHMK" description= " My personal blog "></tags:message>
Attention:
The Tag property cannot be capitalized when it is defined, and the following error occurs when the ID is written as above:
JSP Learning Step 2nd-Tag use