javaee--jsp Label

Source: Internet
Author: User
Tags maven central

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

JSP tags

Jstl:java self-developed a set of tag library, for you to use in the JSP page, you can simplify and beautify the JSP page code, it also has loops, judgments, ternary and other statements, and El expression mixed. Generally we use the Jstl and El expressions to see the Java code on the JSP page.

To use the JSTL tag library, you first need to check the packages that Maven relies on for Jstl:

If you have no JSTL package, you should introduce yourself:

First go to the MAVEN Central Library to bring in the jstl dependency;

Introduction failed, then I put the downloaded package into the Lib under Web-inf, and then Addtobuild,

Then, if you want to use the JSTL tag library in a JSP page, first use the taglib command to bring in the JSTL tag library:

Jstl Tag Library Learning:

1. Expression tokens: Out, set, remove, catch

2. Process tagging: if (no else, single), choose (Multipath-when, otherwise)

3. Loop markers: ForEach, Fortokens

Set tag:

You can also assign a value to an attribute in an object:

If you use the EL expression directly to output, there is no way to filter out the HTML code:

It can be filtered using out, which filters the HTML code into entities:

Of course, the above is the output of the filtering effect, if you do not want to filter, you can use EscapeXML to set false filter:

You can also output default values for some properties that are not available (the same effect can be achieved with ternary):

This remove is a value that can be used to delete the stored property.

Catch can be used to catch information about an exception, and then you can print out the exception error message later.

One-way condition if judged as.

There are multiple conditions to judge:

Multi-path condition judgment, in the meantime can use if statement to do condition judgment.

Use Jstl and El Expressions to change index.jsp pages:

javaee--jsp Label

Related Article

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.