After learning 4 months of Java, I finally started learning JSP while reading the book. On the side of the 9CBS, the document was 3 days. After 3 days, I felt that I had a qualified leap 9CBS, although there were many documents, but they all said the same problem. Solving the method to find out the documentation, even if you find the problem that you can solve your problem is not necessarily suitable for your system. Different solutions to JSP knowledge. Different solutions are not enough, unless their understanding is quite strong. Otherwise, it is difficult to just I have to write my own learning process by these documents. I believe that the 3-day learning process is believed to help the newcomers who have just started learning JSP. What is JSP?
JavaServer Pages (JSP) makes we can separate the static HTML and dynamic part of the page. HTML can be written in any commonly used web making tool, and the writing method is also the same as the original; the code of the dynamic part is placed in a special tag, most of the "<%" starts with "%>". For example, the following is a piece of JSP page, if we use http: //host/orderconfirmation.jsp? Title = core web programming this URL opens this page, the result shows "THANKS for Order Web Programming". Thanks for Ordering <% = Request.getParameter ("Title")%> i> The servlet will appear, if you are an initiator, you can now understand the meaning of servlet, we will explain to you later. Or you jump directly to the last paragraph of this article, this paragraph doesn't look at it. JSP page files are usually in .jsp extension, and can be installed to any places where ordinary web pages can be stored. Although the JSP page is more like a normal web page, the JSP page is more like a servlet, but in fact, JSP will eventually be converted into a regular servlet, and the static HTML directly outputs the output stream associated with the Servlet Service method. The conversion process of JSP to Servlet generally is performed when the first page request appears. So if you want the first user to wait too long because the JSP page is converted to servlet, I hope that the servlet has been properly compiled and loaded, and you can request this page after installing the JSP page. Also note that many web servers allow define alias, so a URL that looks to the HTML file is actually pointing to the servlet or JSP page. In addition to ordinary HTML code, other components embedded in JSP pages mainly have the following three: scripting element, command (Directive), Action. The script elements are used to embed Java code, which will become part of the SERVLET that is converted; the JSP instruction is used to control the structure of the servlet as a whole; the action is used to introduce an existing component or control the JSP engine. To simplify scripting elements, JSP defines a set of variables (predefined variables) that can be used (predefined variables), such as REQUEST in the front code segment is one of them. Simply, the so-called JSP page (* .jsp) is incorporated in the traditional web html file (* .html, * htm) to add Java program clip and JSP tag (TAG). The web server (at this point, when it can process the JSP web page, such as Tomcat), when you encounter a request to access the JSP page, execute the program segment, then return the execution result in the HTML format to the customer. The program segment can operate the database, redirect web pages, send E-mail, perform a specific program, and so on. .