struts1.x Series Tutorial (4): Tag Library Overview and installation

Source: Internet
Author: User

Overview of struts1.x Tag Library

Struts's tag library is divided into the following five categories:

1.HTML Tag Library

The custom tags in the HTML tag library are typically one by one corresponding to the tag in HTML. such as <form> in HTML, various types of <input> in the HTML tag library have a custom label and its corresponding. The purpose of the HTML tag library is to connect the components of the view layer with the control layer (in fact, you can do the same thing without using a custom tag in the HTML tag library, but you need to write more code).

2.Bean Tag Library

The custom tags in the bean tag library are primarily used to output text information to the client. So why does struts have to provide a single tag library to output text messages to clients? There are two reasons:

1. Provide international support for struts (that is, you can read and output text information from a property file to the client).

2. To avoid using Java code directly to obtain content stored in the request and session objects.

3.Logic Tag Library

To avoid using Java code directly in JSP pages for logical judgments and looping operations. The Logic tag library provides a set of tags for doing the same work without using Java code. and using tags to make logical judgments and loops is easier to understand and maintain than using Java code.

4.Nested Tag Library

The label in this tag library has the "nested" attribute in the form or object to display.

5.Tiles Tag Library

This tag library label allows us to create a layout for the view layer (layout).

There are some labels and jstl in Struts's tag library, such as the logical judgment tag of the logic tag library. However, JSTL requires the servlet container to conform to the JSP 2.0 specification, otherwise the JSTL will not work properly. This will not be able to enjoy the powerful functionality that JSTL brings to the program that runs in the lower version of the Servleet container. But the struts tag does not require this. Therefore, if we use struts in our web programs, we recommend that you use the tags in the Struts tag library as much as possible, unless you can guarantee that the Web application's operating environment supports the JSP 2.0 specification.

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.