JSP Learning Tour: What is JSP

1. JSP concept

JSP full name: Java Server Pages (dynamic web development technology, also called JAVA server page), which is essentially a simplified Servlet design. It embeds the JAVA language in the traditional HTML language to form a JSP file, and its suffix is ​​in the form of .jsp.

2, JSP page composition

JSP pages consist of static content (HTML), script programs, JSP declarations, expressions, comments, directives, etc.

2.1 Static content: It is the static text of the JSP page content, which is HTML text.

2.2 Script: It can contain arbitrary Java statements, variables, methods, expressions. Its grammatical format is to embed the Java statement segment into <% %>,

     For example: <% System.out.println(100/0) ;   %> Don't forget the semicolon after the statement segment.

2.3 JSP declaration: A declaration statement can declare one or more variables, and the method is used by the following Java code. In JSP, it must be declared before use.

                   For example: < % !int i=1; %> , < % ! %> is equivalent to defining a global variable. An exclamation mark is equivalent to defining a global variable. <%%> is equivalent to defining a local variable.

2.4 Expression: The format is as follows:

                    <%=expression body%>, for example: <%=page.toString%>, do not add a semicolon at the end of the expression.

2.5 Comment: <% --Comment--%>, the comment format in HTML is: <% !--Comment--%>

2.6 Instructions: Instructions in JSP are used to set relevant properties of the entire page. The syntax format is: <% directive attribute = "value"%>

                1. <% @ page ...%> defines the dependency properties of the page, such as scripting language, error page, and cache requirements.

                2. <% @include...%> includes other files

                3. <% @taglib...%> introduces the definition of the tag library, which can be a custom tag.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324603373&siteId=291194637
jsp