To customize a tag, follow these steps:
1. Create a new folder tags under the WEB-INF directory and then create the file xl. tag ----------- in the next folder. There cannot be any changes
2. Write the necessary code and attributes in the xl. tag file.
Code example;
<% @ Tag pageEncoding = "UTF-8" %> // sets the encoding.
<% @ Attribute name = "pm" required = "true" rtexprvalue = "true" type = "com. zuxia. xlmodel. PageModel" %>
<% @ Attribute name = "url" required = "true" type = "java. lang. String" %>
Understanding:
Tag: Import command
Name: name of each attribute
Required: boolean whether to assign a value to this attribute When referencing this tag
Rtexprvalue: whether boolean supports expression formats such as EL
Type: If a custom object is referenced, type --> package name. entity. Otherwise, type the original data types such as java. lang. Integer [String ].
If the custom tag contains content in the TAG body of the jsp page, set the value:
<Jsp: doBody var = "mycontent" scope = "request"/>
Var: Custom variable
Scope: Value Range
Custom tag for jsp page call:
<% @ Taglib tagdir = "/WEB-INF/tags" prefix = "xl" %>
Taglib: Import command
Tagdir: the value of tagdir is immutable to reference the path of a custom tag.
Prefix: alias of a custom expression
<Xl: x l> The Name Of The created tag is the alias of the tag in front of the tag body. <xl: xl>
Author: "a small stream"