JSP custom tags (SimpleTagSupport)

1. Specify the TLD file in web.xml


 

2. Create a TLD file and configure label information



 

3. Write the label class (the label display content is written into the FTL template)



 


 

4. Introduce the tag library at the top of the jsp page and use



 


 5. The benefits of using custom tags:

--JSP tags can improve the readability of JSP pages. The purpose of using JSP tags is to eliminate the Java code in <%%> of JSP pages.

--The page art work and programming can be separated.

--Custom JSP tags are usually used for reuse. For example, the same function does not need to write the same code on different pages, which is convenient for page code maintenance.

 

Attachment: Freemarker Documentation

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327045619&siteId=291194637