JSP base syntax two use of annotations

Source: Internet
Author: User
Tags tomcat

One of my classmate asked me, Java has "//" This kind of annotation, easy to use, JSP annotation is not this? "//" is not available in the JSP.

For a JSP that has studied for such a long time, annotations are the most basic. The annotations in the JSP are different from Java.

Two types of annotations are supported in the JSP, one is to display the annotation, the annotation client is allowed to see, and the other is an implicit annotation, which is invisible to the annotation client.

Show comment Syntax: <!--annotation content-->

implicit annotation Syntax:

Format one://comment, single-line annotation;

Format two: * * NOTE * *, multiline annotation;

Format three: <%--annotation--%>,jsp annotation

Implicit annotations It is important to note that there are two annotations that inherit from the Java style, but in this case a new annotation is extended,<%--%>

The following is a program that observes the use of annotations:

<!--This annotation client can see the
 annotations in the--> <!--JSP, the client cannot see
 the     
     single-line comment provided in--> <%//java, the client cannot see/     
    *     
       Multi-line annotation provided in Java, client cannot see     
    /     
 %>     
 <%--also can't see--%>

Run Result: the page is blank.

Since it is a JSP program, you must have the support of the Web container when you execute it, so you have to start Tomcat, then access Tomcat through the browser, and execute the program.

In fact, the so-called display is still inherited, from the style of HTML language to continue to use the

When the JSP finally executes, it becomes HTML style

This article is from the "Zhao Yuqiang blog" blog, please be sure to keep this source http://zhaoyuqiang.blog.51cto.com/6328846/1111131

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.