Dynamic Web Development Fundamentals

The difference between static pages and dynamic pages:
Static web pages:
data cannot be interacted with, and are not obtained from the database in real time
Dynamic web pages:
data can interact with users and are linked with database connections, which need to be deployed in the server
B/S and C/S Architecture differences:
  B/S    C/S
Software Installation     Just need a browser Client needs to be installed
Upgrade maintenance      Client zero maintenance Need separate upgrade and maintenance
performance Performance is reflected on the server Performance is reflected in client hardware
Platform related Minimal relationship to platform more related to the platform

Server: One that provides users with resources and corresponding computer equipment
Web server: generally refers to website servers
Common web servers: Tomcat, JBoss, WebLogic
B/S Working principle: mainly the corresponding and requested problems
URL and URI: URL (unified Resource Locator), URI (Uniform Resource Identifier).
JSP:
JSP (Java Serve Pages): is a dynamic web development technology
Identifier :
Instruction Identifier: <%@ Instruction%>
JSP Script Identifier: <% Java Script Declaration Local Variables%>
Output Identifier: <% = Expression %>
Declaration Identifier: <%! Declare Java Methods and Member Variables %>
JSP Comment Identifier: <%--JSP Comment Page, Page Source Code Can't See --%>
HTML Comment: <!-- HTML comments. The page source code can be seen >
built-in objects:
page: corresponds to this. Represents the current page
pageContext: corresponds to the PageContext. The context object for the current page.
request: corresponds to HttpServletRequest. request object.
response: corresponds to HttpServletResponse. response object.
session: corresponds to HttpSession. session object.
application: corresponds to ServletContext. application object.
out: corresponds to JSPWriter. output object.
config: corresponds to ServletConfig. Configuration object.
exception: corresponds to Throwable. exception object.
Execution process:
The browser accesses the server through a URL request.
The server container finds the JSP file specified by the URL.
Translate the found JSP page into a .java file; if the JSP page is not modified, it will only be converted once when accessing the JSP.
Compile and convert .java source files into .class bytecode files.
Execute the .class file and respond to the user's response.
Lifecycle:
Initialization: init(). Executed only once when the user first accesses.
service: JSP service code. Executed once per visit.
Destroy: destroy(). Do it again after the server is shut down.
Data interaction:
URLEncoding="UTF-8". Solve the problem of garbled get request.
request request object:
getContextPath(): get the relative path of the web project
getSchme(): get the protocol name
getServerName(): get the server name
getServerPort(): get the server port number
getParameter(): get the specified request parameter value
getParameterValues(): Get the specified request parameter set
getSession(): Get the session object of the current request
getCookies(): Get all cookie sets
setAttribute(): Save the attribute value to the request scope
setCharacterEncoding(): Set the request encoding format of the request
getMethod(): Get the request type
getRequestDispatcher(): Get the repeater
response response object:
setCharacterEncoding (): Set the encoding format of the response
addCookie(): Add a cookie
SetHeader(): Set the header information
SetStatus(): Set the status code
SendRedirect(): Redirect
SetContentType(): Set the data type of the browser
GetOutputStream(): Get The byte stream object output to the browser
GetWriter(): Get the character stream object output to the browser
Request forwarding:
01. Forwarding is the behavior of the server 02. The
URL address will not change
03. Data will not be lost
04. Extend a request Scope
Response redirection:
01. Redirection is the behavior of the client
02. The URL address will change and is the path of the last request
03. Data will be lost
04. At least two visits to the server

Guess you like

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