JSP Full name: Java Server Pages. Java server-side page.
Essentially a simplified servlet design that enables the use of HTML tags in java. JSP is a dynamic web development standard, like a servlet, executed on the server side.
Common dynamic Website Development technology:
Jsp:java platform, high security, suitable for the development of large, enterprise-class Web applications.
Asp. NET: Based on visual component development, security, cross-platform poor, the best use of Microsoft supporting systems.
PHP: For small and Medium business Web application Development, Gold Development portfolio: linux+apache+mysql+php
JSP basic syntax
JSP three main instruction elements: Import page Taglib
Page instruction Syntax:
<% @page Property 1 = "Property Value" Property 2 = "Property value 1, property value 2" ... Property N= "Property value N"%>
Page directive Common Properties:
Property |
Describe |
Default value |
Language |
Specify the scripting language to use for JSP pages · |
Java |
Import |
Introduce the class file used in the scripting language |
No |
ContentType |
Specify the encoding used for JSP pages |
File type: text/html; Character encoding: Iso-8859-1 |
Cases:
<%@page Language="Java"Import="java.util.*"ContentType="Text/html;charset=utf-8"%>
JSP annotations
HTML comments : comments on the JSP page
<!-- I'm an HTML comment - The client is visible and the page does not appear
JSP Comment: <%--jsp comment--%> server-side comment, client not visible
JSP script Comments:
// Single-line comment
/* Multi-line comments */
JSP script
Java code executed in the JSP page, written in the JSP tag <% Java code%>
Cases:
<% // single-line comment Out.printlin (" Hello everyone!") "); %>
JSP declaration
Define variables or methods in the JSP page, syntax: <%!java code%>
<%! Strings="Zhang San"; intAdd (intx,intt;) {return x+y;}%>
JSP expressions
Expressions executed in JSP pages, syntax: <%= expressions%>//NOTE: Expressions do not end with semicolons
Cases:
<BR>How are you doing<%=s%></BR>X+y<%=Add (Ten,5)%>
JSP page life cycle
Phase Project
Printing 99 multiplication tables using expressions and script implementations, respectively
"Mooc notes" JSP basic syntax