Custom tag (value)-myEclipse8.6

Source: Internet
Author: User

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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.