JSP basic syntax

Source: Internet
Author: User

One, implicit annotation syntax

Format one://comment, when line comment

Format two:/**/, multi-line Comment

Format three: <%--comment--%> jsp comment

<!--This annotation client can see-

<%--comments in JSP, client cannot see--%>

<%

/*

Multi-line annotations provided in Java that the client cannot see

*/

A single-line comment provided in Java that the client cannot see

%>

  

Second, Scriptlet

The first type of scriptlet uses <%%> representations, where local variables can be defined in this scriptlet, writing statements, etc.

The second scriptlet uses the <%!%> representation, in which global variables, methods, classes can be defined in this Scriptlet

The third type of scriptlet with <%%>, the main function is to output a variable or a specific content, also known as expression output

Scriptlet Label

Using a lot of <%%> in a program can lead to code clutter, so a scriptlet tag is provided in the new version of the JSP that allows you to do the same with <%%>

<jsp:scriptlet>

Java scriptlet

</jsp:scriptlet>

Page Common directives

The above configuration indicates that if a 404 or 500 of the HTTP status code appears in the project, or a null point to the exception, it will jump to the page to display, when the jump past the address bar also no change, so the server is still jumping

Passing two parameters to a contained page

This also belongs to the server jump

JSP basic syntax

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.