1. JSP directives:
(1). page directive: Usually at the top of a JSP page, the same page can have multiple page directives
Syntax: <%@ page Property 1 = "Property Value" Property 2 = "Property value 1, property value 2"%>
Common Properties:
Language: Specifies the scripting language used by the JSP page; default value: Java
Import: Use this property to refer to the class file used in the scripting language; Default value: None
ContentType: Used to specify the encoding method used by the JSP page; default value: Text/html, iso-8859-1
(2). include directive: Embed an external file into the current JSP file and parse the JSP statements in this page
(3). taglib directive: Use tag Library to define new custom tags and enable custom behavior in JSP pages
2. JSP Comments:
HTML comments:
<!--html comment-->: client visible
JSP comments:
<%--JSP comment-->: Client not visible
JSP script Comments:
Single-line Comment: Client not visible
/**/Multi-line Comment : Client not visible
3. JSP script: <% java code%>
JSP declaration: <%! Java Code%>
JSP expression: <%= expression%>
Note: An expression does not end with a semicolon.
A method can only be declared in a declaration, a variable defined in the script is a local variable, and the variable defined in the declaration is a global variable.
4. Two ways to do the 99 multiplication table for JSP:
<% @page import= "java.io.IOException"%><%@ page language= "java" contenttype= "text/html; Charset=utf-8 "pageencoding=" UTF-8 "%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" >
"JSP Basics" (1) JSP basic syntax