-
What are the built-in objects of jsp? What are the functions? What are the methods?
-
How to use JavaBean s in JSP?
-
Common instructions for JSP
-
Four ranges of jsp?
-
jsp scope from large to small
-
What are the functions of filters?
-
Filter usage? (uniformly encode the requests of the client and authenticate the client)
-
How to realize the request forwarding in JSP and Servlet respectively?
-
What are the similarities and differences between JSP and Servlet, and what is the relationship between them?
-
Describe MVC in detail.
-
Experience gained in doing projects.
①: DNS Domain name resolution IP address ②: The client establishes a connection with the server(TCP Three handshakes) ③: Client initiated request ④: The server received the request according to the port number.Find the corresponding resource file and respond to the source code to the client ⑤: The client gets the requested data(html Page source code),Start parsing pages and requesting resources ⑥: Client render page ⑦: web Server Disconnected(Four waves)
2. The difference between GET and POST of http request
Form Medium get and post Method, corresponding to http Consensual GET and POST method. The main differences between the two are as follows: (1)Get Is used to obtain data from the server, and Post Is used to transfer data to the server; (2)Get Convert the data in the form into variable=value Form, add to action Point to URL After, and use "? For both Connect, and use between variables“&"connect; Post Is to put the data in the form form In the data body of, it is passed to the action Point to URL; (3)Get It is not secure because during transmission, the data is placed in the requested location URL Medium; Post All operations are invisible to the user; (4)Get The amount of data transmitted is small, mainly because it is affected by URL Length limit; and Post It can transmit a large amount of data, so it can only be used when uploading files Post; (5)Get limit Form The data set of the form must be ASCII Character, and Post Support the whole ISO10646 Character set; (6)Get yes form Default method for.
Servlet It is a server-side independent of platform and protocol Java Technology that can be used to generate dynamic Web Page. With traditional CGI(Computer graphics interface) and many other similar CGI Compared with technology, Servlet It has the characteristics of better portability, more powerful functions, less investment, higher efficiency and better security. Servlet Is to use Java Servlet Application program interface( API)And related classes and methods Java Procedure. Java What language can do, Servlet Basically, it can be realized (except the graphical interface). Servlet It is mainly used to process data from the client Http Request and return a response. so called Servlet Means HttpServlet,For processing Http Requests that it can handle are doGet(),doPost(),service()And other methods. In development Servlet When, you can inherit directly javax.servlet.http.HttpServlet. Servlet Need in web.xml For example, mapping execution Servlet Name, configuration Servlet Class, initialization parameters, security configuration URL Map and set startup priority, etc. Servlet Can not only generate HTML Script output, or binary form output can be generated. Servlet It has a wide range of applications. We now use many popular framework technologies, and its most basic code is inseparable Servelt Support. Like what I'm familiar with SSH Frame, Spring When the container starts, you should web.xml Medium loading Spring Container ActionContext Class Spring Some parameters of the system, such as dependency injection, mapping of database tables, and initializing the security configuration settings of the system read And other properties.
4. What about the servlet lifecycle?
servlet There is a good definition of lifetime, including loading and instantiation, initialization, processing requests, and service termination. This survival period is determined by javax.servlet.Servlet Interfaced init,service and destroy Method expression. servlet After being instantiated by the server, the container runs its init Method to run its when the request arrives service method, service Method to automatically dispatch the run corresponding to the request doXXX Method( doGet,doPost)When the server decides to destroy the instance, call its destroy method. web Container loading servlet,The life cycle begins. By calling servlet of init()Method servlet Initialization of. By calling service()Method implementation, calling different methods according to different requests do***()method. End of service, web Container call servlet of destroy()method.
5. Basic architecture of Servlet
package test; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ServletName extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { } public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { } }
6. What is the difference between forward () and redirect() in servlet API?
The former is only the change of control in the container, and the address after the change will not be displayed in the address bar of the client browser; The latter is a complete jump. The browser will get the jump address and resend the request link. In this way, you can see the link address after jump from the address bar of the browser. Therefore, the former is more efficient. When the former can meet the needs, try to use it forward()Method, and it also helps to hide the actual links. In some cases, for example, you need to jump to a resource on another server sendRedirect()method.
7. Common methods of Request object
setAttribute(String name,Object): Set name to name of request Parameter value of getAttribute(String name): Return by name getCookies(): Returns all of the client's Cookie Object, the result is a Cookie array getCharacterEncoding(): Returns the character encoding method in the request getParameter(String name): Get the information transmitted from the client to the server name Specified parameters getRequestURI(): Gets the address of the client issuing the request string getRemoteAddr(): Get client's IP address getRemoteHost(): Gets the name of the client getServerName(): Gets the name of the server getServletPath(): Gets the path to the script file requested by the client getServerPort(): Gets the port number of the server removeAttribute(String name): Delete an attribute in the request
8. Briefly describe the function and usage of HttpSession, which can be described by code
HttpSession User information can be tracked and stored in, and the value can be set into the attribute. There are two methods: setAttribute(),getAttribute(); For example, in a method session.setAttribute("student",student);In a session Set a property named student,The value is a value named student Object. Then at the same time session Used within the scope getAttribute("student")Take out the attribute and get student Object.
9. What are the built-in objects of jsp? What are the functions? What are the methods?
jsp There are 9 built-in objects: request Client request, which will contain information from GET/POST Requested parameters response The web page returns the client's response pageContext The properties of web pages are managed here session Session duration associated with the request application servlet Executing content out The output used to transmit the response config servlet Frame components page JSP Web page itself exception Uncapped exceptions for error pages request: express HttpServletRequest Object. It contains information about browser requests and provides several methods for obtaining cookie, header, and session A useful method of data. response: express HttpServletResponse Object and provides several methods for setting the response sent back to the browser (such as cookies,Header information, etc.) out: Object is javax.jsp.JspWriter And provides several methods that you can use to send back the output results to the browser. pageContext: Represents a javax.servlet.jsp.PageContext Object. It is used to facilitate access to a wide range of namespaces servlet Of related objects API,And packed with general servlet Methods of related functions. session: Represents a request javax.servlet.http.HttpSession Object. Session User status information can be stored applicaton : Represents a javax.servle.ServletContext Object. This helps you find information about servlet Engine and servlet Environmental information config: Represents a javax.servlet.ServletConfig Object. This object is used to access servlet Initialization parameters of the instance. page: Represents a generated from the page servlet example
10. How to use JavaBean s in JSP?
stay JSP Used in JavaBean Common actions are: <jsp:useBean />: Used to create and find bean Object; <jsp:setProperty />: Used to set bean Property of the, that is, its setXxx()method; <jsp:getProperty />: Used to obtain bean Property of the, that is, its getXxx()method
11. Common instructions for JSP
isErrorPage(Can it be used Exception object),isELIgnored(Ignore expression)
last
Xiaobian carefully prepared first-hand materials for everyone
**Click here for free **The above Java advanced architecture information, source code, notes and videos. Dubbo, Redis, design pattern, Netty, zookeeper, Spring cloud, distributed, high concurrency and other architecture technologies
[attachment] presentation of architecture books
- Analysis of 20 high frequency database problems in BAT interview
- Java interview dictionary
- Netty practice
- algorithm
BATJ interview points and advanced data of Java Architect
8290156)]
**Click here for free **The above Java advanced architecture information, source code, notes and videos. Dubbo, Redis, design pattern, Netty, zookeeper, Spring cloud, distributed, high concurrency and other architecture technologies
[attachment] presentation of architecture books
- Analysis of 20 high frequency database problems in BAT interview
- Java interview dictionary
- Netty practice
- algorithm
[external chain picture transferring... (IMG mnaasra8-1628568290158)]
BATJ interview points and advanced data of Java Architect
[external chain picture transferring... (img-QOp7TDTS-1628568290161)]