I. Basic CONCEPT 1.C/S: Client server refers to clients service
b/S: Brower server refers to the browser service, without installation, only need to have a server. 2.JSP Basic Concepts
JSP full Name Java Server page, the JSP page is a page that runs on the server.
A Dynamic Web page is a Web page that interacts with data in the background.
The differences between the languages:
- JSP is developed in the Java language, high security, suitable for large projects, enterprise-class applications, distributed projects, server clusters, Hadoop, Spark (Big Data)
- ASP. NET uses C #,. NET platform, easy to use, because it is not open source, so security is low, and can not be used across platforms. NET development projects, preferably using Windows systems and SQL Server databases
- PHP simple and efficient low-cost development cycle short, suitable for small and medium-sized enterprise Web application development, PHP Gold Partner---(Lamp:linux, Apache, Mysql, PHP) WAMP
3. Server
Refers to an address that is used to accept client requests and uses a Tomcat server when learning Java Web
A few servers commonly used
Jboss
WebLogic (servers used by most companies)
Nginx
Websphere
4.Tomcat Introduction (middleware server)
Bin Storage executable File
conf all configurations of Tomcat
WebApps projects that need to be deployed
Logs log
Temp Temporary file
files compiled after work Tomcat is run
Lib the jar files required to run the Tomcat server
5. New Project
right mouse button to create a new Dynamic Web project
Context root: Refers to the root directory name, the default is the same as the project name
Content directory: Store the html,css,img file used on the Web page, etc., default name WebContent
Create a new Jsp.file file in WebContent under the project folder
When the 6.eclipse process is turned off, the server state, if displayed as stop, newspapers port error when running the server again, which requires shutting down the JAVAW process in the task management process, that is, shutting down the server process.
Two. JSP directive identifies 1.page instructions
Format: <%@ page ........%>
Property:
Language---The language used for the current page: Java is currently only supported;
Import---The class library introduced by the current page, which is not introduced by default;
ContentType---text/html; charset= ' character set '; Iso-8859-1 is the default value of the character set, is a plain English character set, inserting Chinese needs to be changed to UTF-8;
ErrorPage---Defines the page that jumps when the current page is faulted;
Iserrorpage---Define whether the current page is an Error alert page and need to change the value to true;
2.include instruction
The directive can contain another JSP page in a JSP page, which is statically contained, does not do any processing, two files cannot have the same name variable;
The directive has only one file property, which specifies the path to include the file, either relative or absolute.
Format: <%@ include file= "..."%>
3.taglib instruction
This directive identifies the tag library used in declaring the page, references the tag library, and specifies the label's prefix. This allows you to refer to tags in the tag library by prefix.
Format: <% @taglib prefix= "" uri= ""%>
Property:
Prefix: The prefix used to specify the label. The prefix cannot be named JSP, Jspx, Java, javax, Sun, servlet, and SUNW.
URI: Used to specify where the tag library file is stored.
Three. JSP common script ID 1. Expression:
Format: <%= expression%>
can be a complete expression of any Java language, and the result of the operation will be converted to a string.
A JSP expression can be inserted into the text of a Web page or inserted into an HTML tag to dynamically set the value of a property.
2. Claim identification:
<% code that declares a variable or method%>
3. Code snippet:
Format: <% Java code or script code%>
The difference between a code fragment and a claim identity is that the life cycle of the claim identity is from creation to server shutdown, while the life cycle of the code fragment is destroyed when the page is closed;
Four. Comments in the JSP comment HTML:
1.<!--Note content-->: visible in source code;
2.<%--comment Content-->: The source code is not visible, the security is higher;
Comments in the script:
1.//: Line comment;
2./* Note content */: Multi-line comment;
3./** Note Content */: Document comments;
JAVA Web Foundation 1