JSP basic syntax

Source: Internet
Author: User

1.JSP annotations

<%--the contents of the comment –%> the comment cannot be seen in the browser

Statement of the 2.JSP

<%! Variable definition/method definition/class%>

Expressions for 3.JSP

<%= variable or expression%>

Execution statement for 4.JSP

<% EXECUTE Statement%>

Page directive for 5.JSP

<% @page attributel= "value1" [... attribute2= "Value n"]%>

Attribute (attributes) are: language,import,pageencoding, where language must be set, import is used to declare the package to be imported, pageencoding is used to set the page encoding

The include directive for 6.JSP

<% @include file= "URL"%>

Include directives are often used to include the same pages that appear frequently in a Web site.

Taglib Instructions for 7.JSP

<% @taglib uri= "Tagliburl" prefix= "Tagpre"%>

Where the URI attribute is used to represent the location where the custom tag library is stored. Prefix property is to distinguish the label names of different tag libraries

8.<jsp:include> Action

<jsp:include page= "Relative URL" flush= "true"/>

Page is a required property of the <jsp:include> action, which refers to the path where the file needs to be included, which can be either relative or absolute.

The Flush property is used to specify whether the output buffer is transferred to the imported file and, if true, is included in the imported file and, if specified as false, in the source file.

9.<jsp:forward> Action

<jsp:forward page= "Relative URL" >

The value of the page property is relative to the URL, request a jump instruction, the request is covert.

10.<jsp:param> Action

<jsp:param name= "parameter name" value= "parameter Value" >

Used to pass the page's parameters to the target page

JSP basic syntax

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.