JSP Learning articles: jsp brief

  These days started learning JSP and Servlet, write some blog, record their own learning process, beginning practitioners considered himself a witness.

First, what is JSP

  JSP stands for Java Service Page, a dynamic web page development technology, different from static Web pages. (Static and dynamic web pages difference: whether to change with time, location and user actions changed for example such as QQ and micro-channel, if the server update, all software needs to be upgraded, you need to reinstall but the web version, for example. Jingdong servers and a variety of browsers, with changes in the operation of the user changes.) JSP is a Java Servlet, mainly used to implement the user interface portion of Java Web applications.

  We generally can combine the HTML code, XHTML code, XML elements and embedded operating JSP and commands to write JSP.

Two, JSP life cycle

  JSP is the life cycle from creation to destruction. Similar Servlet life cycle Servlet life cycle and the difference is that the JSP life cycle includes a JSP file compiled into Servlet.

 Specific stages: Stage 1 compilation: Servlet Servlet source file is compiled into the container, to generate Servlet class.

                  Initialization Stage 2: Load and jsp Servlet corresponding to the class, create an instance, and calls its initialization method

                  3 implementation phase: the JSP to call the corresponding methods Servlet service instance.

                  4 invoked Servlet examples destruction stage corresponding to destruction method corresponding JSP, Servlet examples and destruction.

 Three, JSP execution flow

  1, for morphology: jsp -> java (servlet) -> class

  2, the first execution of server-side jsp will be translated into Java, Java and then compiled into class files, direct access to the second access class files. If the server-side code changes well, will be re-translated and compiled during his visit.

Four, jsp advantage

  1, compared with ASP, JSP has two advantages, first of all, the dynamic part is written in Java, rather than the VR or other MS-specific language, it is more powerful and easy to use. It followed JSP easily portable to non-MS internet.

  2, compared with the pure language Servlet, JSP can easily write or modify HTML pages without having to face a lot of println statements.

  3, compared with the SSI, SSI form data can not be used, the connection to the database.

  4, compared with JavaScript, although JavaScript can dynamically generate HTML on the client side, but it is difficult to interact with the server can not provide complex services, such as access to the database and image processing.

  5, compared with static HTML, static HTML does not contain dynamic information.

 

Guess you like

Origin www.cnblogs.com/ym77/p/11305234.html
jsp