jsp简答题(JSP simple answer)
First, the working principle of Jsp
When a JSP file is requested for the first time, the JSP engine (itself is also a Servlet) first converts the JSP file into a Java source file. In the conversion process if it is found that the JSP file has a syntax error, the conversion process will break, and the output error information to the server and the client; if the conversion is essful, the JSP engine with javac the Java source piled into the file and file is loaded into memory.
Next, create an instance of the Servlet and execute the jspInit () method of the instance (the jspInit () method is only executed once in the life cycle of Servlet).
Then you create and start a new thread, and the new thread calls the jspService () method of the instance. (for each request, the JSP engine creates a new thread to process the request. If multiple clients request the JSP file at the same time, the JSP engine creates multiple threads, each requesting a thread corresponding to it.
In the browser called JSP file, the Servlet container will take the browser request and response to the browser package HttpServletRequest and HttpServletResponse objects, and call the corresponding Servlet instance (jspService) method, the two object is passed as a parameter to the jspService () method.
After the jspService () method executes, the HTML content is
returned to the client.
If the JSP file is modified, the server will decide whether to pile the file according to the settings. If you need to pile, compile the result instead of the Servlet in memory and continue the process. If at any time, due to insufficient system resources, the JSP engine will remove Servlet from memory in some uncertain way. When this happens, the jspDestroy () method is called first, and then the Servlet instance is tagged into garbage collection.
Two, include grammatical elements analysis
instruction
Include can insert JSP code before the JSP pa
jsp简答题(JSP simple answer) 来自淘豆网m.daumloan.com转载请标明出处.