Tag Library, the eternal topic of controversy

Source: Internet
Author: User
Tags html tags

tag libraries, which are just a part of the framework, are designed to address the components of HTML tags that are generated by page display data, and encapsulate simple page logic.

So do not hallow the label, nor do you think learning tags are the most important part of learning a web framework, because they are just a little bit of the framework.

Directory

The original intention of the label

The label, the antidote or the poison.

The development and trend of labels

Label category

Label assignments

The original intention of the label

At the beginning of JSP, JSP provided the features of embedding Java code in HTML code. This feature makes it easier to take advantage of the strong-typed language of Java to accomplish many complex business logic.

However, over time, we found that embedding too much Java code in HTML code is very detrimental to the maintenance and extension of JSP. For thousands of lines of JSP code, many times, the programmer basically lost the ability to maintain JSP. Based on the above problem, we try to use a new technique to solve these problems. This is the original intention of the label:

1. Try to avoid using Java code in JSP pages, and instead use HTML-like tags to express the logic of the page, so that the logic and display separation, improve the maintainability of JSP

2. Because of the lack of ability to express HTML tags, HTML semantics can be extended by using JSP tag to accomplish many of the HTML tags that cannot be completed.

The label, the antidote or the poison.

The debate has been on the label. As early as 2004, Robbin classmate to a text "puffing out taglib, my a piece of posters!" Has aroused a lot of people's discussion about taglib. At that time, Robbin's point of view was probably this:

Robbin wrote

I think JSP inside the use of tag, is a mistake! I am opposed to using tag in JSP, I recommend that you write Java code in the JSP, yes, is in the JSP to write Java code, I have been doing so!

The introduction of Taglib from Sun in JSP, I think he is a lie! I think everyone's been fooled by Sun, I do JSP programming, whenever I have written JSP, I never use tag, I feel that writing Java code to make me very comfortable, I do not need to learn that awkward and meaningless tag syntax, to increase my workload, to increase the difficulty of my JSP page debugging.

I do not know whether the 5-year lapse, Robbin's point of view has changed. In these 5 years, the JSP's presentation layer scheme has not really changed much. Taglib has not died out, and Ajax technology has grown even more vigorously, and template technology has been seen as an important presentation layer technology that is ripe and available for use.

Label, in the end is the antidote or poison? Can it bring convenience to the view layer development? We need to look at this problem more dialectically. We first sum up the pros and cons of all the labels:

Square

1. The original intention of the label is not wrong, it exists, can simplify the difficulty of JSP development, and many of the HTML tags to expand the function

2. The label from the effect does to some extent solve the JSP page, avoid the use of Java code

3. Due to the advantages of Java syntax and performance, the use of taglib can be greatly encapsulated into block HTML code, thus forming a complete set of page components, can greatly simplify the page development

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.