What is the difference between JSP and SERVLET in the application? Many people are confused. Let me say a few things. Simply put, SUN first developed the SERVLET, which has powerful functions and advanced system design. However, it still uses the old CGI method to output HTML statements, therefore, it is inconvenient to write and modify HTML. Later, SUN introduced an embedded JSP similar to ASP and embedded the jsp tag into an HTML statement. This greatly simplifies and facilitates the design and modification of webpages. New Network languages such as ASP, PHP, and JSP are embedded SCRIPT languages.
From the perspective of a three-tier network structure, a network project can be divided into at least three layers: data layer, business layer, and presentation layer. Of course, it can be more complicated. SERVLET is powerful for writing business layers, but it is inconvenient for writing presentation layers. JSP is designed to facilitate the writing of the presentation layer. Of course, you can also write a business layer. Friends who are familiar with ASP, PHP, and CGI often unconsciously mix the presentation layer and business layer. Just like the previous friend who put the database processing information in JSP, in fact, it should be placed in the business layer.
According to SUN's recommendation, JSP should only store the content related to the presentation layer, that is, only the part of the HTML webpage is output. All data computing, data analysis, and database connection processes belong to the business layer and should be placed in java beans. Java beans are called through JSP to achieve integration of two layers.
In fact, Microsoft recently launched the DNA technology, simply put, ASP + COM/DCOM technology. Similar to JSP + BEANS, all presentation layers are completed by ASP, and all business layers are completed by COM/DCOM. Integration is achieved through calling.